From 45a54903feaab08ae3980a1aa4ce8635480d105b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Aug 2007 03:08:46 -0300 Subject: Make dvbdev compatible again with older kernel versions From: Mauro Carvalho Chehab class_device_create/class_device_destroy are being replaced by device_create/device_destroy. This patch make it backward compatible. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/dvb-core/dvbdev.c | 4 ++++ v4l/compat.h | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index f44ab30de..564c57b79 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -211,7 +211,11 @@ 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) struct device *clsdev; +#else + struct class_device *clsdev; +#endif int id; mutex_lock(&dvbdev_register_lock); diff --git a/v4l/compat.h b/v4l/compat.h index 584d96035..1162dadac 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -282,10 +282,11 @@ static inline int vm_insert_page(struct vm_area_struct *vma, # define class_device_destroy(a, b) class_simple_device_remove(b) # define class_create(a, b) class_simple_create(a, b) # define class_destroy(a) class_simple_destroy(a) -#else -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) +#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) -#endif +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +# 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 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) -- cgit v1.2.3