From 66457790914e610bc7f372d47794cee4304ba959 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Tue, 3 Mar 2009 13:53:13 -0800 Subject: compat: rename struct delayed_work to work_struct on pre-2.6.20 From: Trent Piepho In v2.6.19-rc6-118-g52bad64 struct work_struct was changed to be only for non-delayed work and struct delayed_work was created for delayed work. Instead of putting ifdefs in the drivers, we use compat.h to rename delayed_work to work_struct on pre-2.6.20 kernels. This will only be a problem if some driver decides to create identifiers named both work_struct and delayed_work in the same scope. There is one driver that has something named work_struct and none with anything named delayed_work, so I don't think will be a problem for as long as this compat code sticks around. Priority: normal Signed-off-by: Trent Piepho --- v4l/compat.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'v4l/compat.h') diff --git a/v4l/compat.h b/v4l/compat.h index b00e8eaf3..207cd3033 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -5,6 +5,14 @@ #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 +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) #define KERN_CONT "" #endif -- cgit v1.2.3 From 01a7001ac3872b08071cd0d9308930da838fe6b6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 3 Mar 2009 13:56:12 +0000 Subject: Drop I2C_M_IGNORE_NAK compatibility bit From: Jean Delvare I2C_M_IGNORE_NAK is defined since kernel 2.5.54 so we don't need to declare it in the compatibility header. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- v4l/compat.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'v4l/compat.h') diff --git a/v4l/compat.h b/v4l/compat.h index 207cd3033..3df844c87 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -49,10 +49,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 */ -- cgit v1.2.3 From a6d47ce7fbcc080d77c8f2032febc2a39aca13fa Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 5 Mar 2009 02:52:00 -0800 Subject: compat: Add INIT_DELAYED_WORK From: Trent Piepho Turn it into INIT_WORK for pre 2.6.20. Priority: normal Signed-off-by: Trent Piepho --- v4l/compat.h | 1 + 1 file changed, 1 insertion(+) (limited to 'v4l/compat.h') diff --git a/v4l/compat.h b/v4l/compat.h index 3df844c87..44878ce73 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -11,6 +11,7 @@ * 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) -- cgit v1.2.3 From eb8b7bf49ccc32d335f2b934431aeb5fc24220c2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 6 Mar 2009 17:43:12 +0100 Subject: v4l/compat.h: add clamp_val From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- v4l/compat.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'v4l/compat.h') diff --git a/v4l/compat.h b/v4l/compat.h index 3df844c87..16ff90bc4 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -238,6 +238,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 -- cgit v1.2.3