From f2ead120937d5077a260732019a12e6ed6c6752e Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Fri, 17 Aug 2007 12:38:05 -0700 Subject: compat: Fix device_create compat code From: Trent Piepho The current compat code for device_create/destroy doesn't work properly for kernels 2.6.14 or below, and 2.6.18 to 2.6.23. For kernels 2.6.14 and below, the device_create/destroy compat code wasn't enabled. Those kernels need it too. For kernels 2.6.18 to 2.6.23, compat code _was_ getting including, which caused errors since 2.6.18 and above already have device_create and device_destroy. Signed-off-by: Trent Piepho --- linux/drivers/media/dvb/dvb-core/dvbdev.c | 2 +- v4l/compat.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 564c57b79..b4165ddb3 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -211,7 +211,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, { struct dvb_device *dvbdev; struct file_operations *dvbdevfops; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) struct device *clsdev; #else struct class_device *clsdev; diff --git a/v4l/compat.h b/v4l/compat.h index 3910ae2aa..05bada3bc 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -284,7 +284,10 @@ static inline int vm_insert_page(struct vm_area_struct *vma, # define class_destroy(a) class_simple_destroy(a) #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) # define class_device_create(a, b, c, d, e, f, g, h) class_device_create(a, c, d, e, f, g, h) -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +#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 */ # define device_create(a, b, c, d, e, f, g) class_device_create(a, NULL, c, b, d, e, f, g) # define device_destroy(a, b) class_device_destroy(a, b) #endif -- cgit v1.2.3