From 9903c4e6973daa6579771ba67db415a7105d5e44 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sat, 30 May 2009 17:45:46 -0700 Subject: compat: handle __fls From: Trent Piepho __fls() was added for generic code in 2.6.29, existed for just 64-bit arches since 2.6.26 (v2.6.25-5228-g56a6b1e), and was x86-64 only before then. When __fls() doesn't exists we create an inline function that implements it via fls(), which has existed for longer. Priority: normal Signed-off-by: Trent Piepho --- v4l/compat.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'v4l/compat.h') diff --git a/v4l/compat.h b/v4l/compat.h index 6a40e2a33..ce28da615 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -454,4 +454,19 @@ static inline int snd_card_create(int idx, const char *id, #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) #endif +/* __fls() was added for generic code in 2.6.29, existed for just 64-bit arches + * since 2.6.26 (v2.6.25-5228-g56a6b1e), and was x86-64 only before then. We + * only want this compat code when __fls doesn't exist, which 2.6.29 or later, + * non x86-64, and non 64-bit that's 2.6.26 or later. */ +#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) || \ + defined(__x86_64__) || \ + (BITS_PER_LONG == 64 && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))) +/* This define will prevent breakage if __fls was already defined. */ +#define __fls v4l_compat_fls +static inline unsigned long v4l_compat_fls(unsigned long x) +{ + return fls(x) - 1; +} +#endif + #endif /* _COMPAT_H */ -- cgit v1.2.3 From 3d617ed4e7e3194bfe53f0182f22327d76e571d6 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 9 Jun 2009 22:15:30 +0200 Subject: v4l-compat: add I2C_ADDRS macro. 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 ce28da615..b861c518a 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -146,6 +146,12 @@ do { \ ((dev->bus && 0 == strcmp(dev->bus->name, "i2c")) ? to_i2c_client(dev) : NULL) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) +/* Construct an I2C_CLIENT_END-terminated array of i2c addresses */ +#define I2C_ADDRS(addr, addrs...) \ + ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END }) +#endif + #ifndef USB_DEVICE_AND_INTERFACE_INFO # define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ -- cgit v1.2.3 From d082b862b623972e2115326f76612aa40b35c588 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 23 Jun 2009 21:11:47 -0300 Subject: Building system: Improve compatibility for delayed work From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l/compat.h') diff --git a/v4l/compat.h b/v4l/compat.h index 56eb30853..11dc57109 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -9,7 +9,7 @@ * 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) +#ifdef NEED_DELAYED_WORK #define delayed_work work_struct #define INIT_DELAYED_WORK(a,b,c) INIT_WORK(a,b,c) #endif -- cgit v1.2.3