From fca7ef71fcb220fb867d2f6d7e2e691adfa51906 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Tue, 30 Jan 2007 18:25:46 -0800 Subject: compat: Handle input_register_device() change and some others From: Trent Piepho input_register_device() was changed to return an error code instead of being void in 2.6.15. Handle it with a macro wrapper in config.h. For this to work, linux/input.h must be included before config.h. This required some trivial header re-ordering in budget-ci.c and ttusb_dec.c. In kernel 2.6.15-rc1 a helper function called setup_timer() was added to linux/timer.h. Add to compat.h, but require that linux/timer.h be included first to give the definition of struct timer_list. A new 4GB DMA zone, __GFP_DMA32, was added in 2.6.15-rc2. Alias it to __GFP_DMA on older kernels. Handle another 2.6.15 "input_dev->dev to input_dev->cdev.dev" change for some recently added code in cinergyT2.c. Signed-off-by: Trent Piepho --- v4l/compat.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'v4l') diff --git a/v4l/compat.h b/v4l/compat.h index a4f66eee2..4b5f597fb 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -268,6 +268,10 @@ static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) # define input_allocate_device() kzalloc(sizeof(struct input_dev),GFP_KERNEL); # define input_free_device(input_dev) kfree(input_dev) +# ifdef _INPUT_H /* input.h must be included _before_ compat.h for this to work */ + /* input_register_device() was changed to return an error code in 2.6.15 */ +# define input_register_device(x) (input_register_device(x), 0) +# endif #endif #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) @@ -288,6 +292,24 @@ schedule_timeout_interruptible(signed long timeout) } #endif +/* New 4GB DMA zone was added in 2.6.15-rc2 */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) +# define __GFP_DMA32 __GFP_DMA +#endif + +/* setup_timer() helper added 10/31/05, 2.6.15-rc1 */ +/* Need linux/timer.h to be included for struct timer_list */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) && defined(_LINUX_TIMER_H) +static inline void setup_timer(struct timer_list * timer, + void (*function)(unsigned long), + unsigned long data) +{ + timer->function = function; + timer->data = data; + init_timer(timer); +} +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) #define IRQF_SHARED SA_SHIRQ #define IRQF_DISABLED SA_INTERRUPT -- cgit v1.2.3