summaryrefslogtreecommitdiff
path: root/v4l/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/compat.h')
-rw-r--r--v4l/compat.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/v4l/compat.h b/v4l/compat.h
index b00e8eaf3..8e778d7f5 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -5,6 +5,15 @@
#ifndef _COMPAT_H
#define _COMPAT_H
+/* In v2.6.19-rc6-118-g52bad64 struct work_struct was was changed to be only for
+ * non-delayed work and struct delayed_work was created for delayed work. This
+ * will rename the structures. Hopefully no one will decide to name something
+ * delayed_work in the same context as something named work_struct. */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+#define delayed_work work_struct
+#define INIT_DELAYED_WORK(a,b,c) INIT_WORK(a,b,c)
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
#define KERN_CONT ""
#endif
@@ -41,10 +50,6 @@
# define __pure __attribute__((pure))
#endif
-#ifndef I2C_M_IGNORE_NAK
-# define I2C_M_IGNORE_NAK 0x1000
-#endif
-
/* device_create/destroy added in 2.6.18 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
/* on older kernels, class_device_create will in turn be a compat macro */
@@ -234,6 +239,12 @@ static inline int list_is_singular(const struct list_head *head)
min_t( __typeof__( x ), \
( h ), \
( x ) ) )
+#define clamp_val(val, min, max) ({ \
+ typeof(val) __val = (val); \
+ typeof(val) __min = (min); \
+ typeof(val) __max = (max); \
+ __val = __val < __min ? __min : __val; \
+ __val > __max ? __max : __val; })
#endif
#ifdef NEED_ALGO_CONTROL