diff options
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_compat.h | 7 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.c | 58 |
2 files changed, 47 insertions, 18 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_compat.h b/linux/drivers/media/dvb/dvb-core/dvb_compat.h index 87cbc5e86..cd2d0c3f4 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_compat.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_compat.h @@ -7,8 +7,6 @@ #include <linux/version.h> #include <linux/fs.h> -#include "dvb_functions.h" - /* necessary dummy functions due to the > 2.5.67 kernel i2c changes */ #define i2c_get_adapdata(adapter) (struct saa7146_dev*)adapter->data; @@ -117,11 +115,6 @@ extern struct page * vmalloc_to_page(void *addr); #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) #endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,66)) -#define devfs_mk_dir(parent,name,info) devfs_mk_dir(name) -#endif - /* USB compatibility */ #include <linux/usb.h> diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 9ac944c3c..9d6d6881f 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -34,11 +34,12 @@ #include "dvbdev.h" #include "dvb_functions.h" - static int dvbdev_debug = 0; #define dprintk if (dvbdev_debug) printk +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) static devfs_handle_t dvb_devfs_handle; +#endif static LIST_HEAD(dvb_adapter_list); static DECLARE_MUTEX(dvbdev_register_lock); @@ -192,7 +193,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, const struct dvb_device *template, void *priv, int type) { struct dvb_device *dvbdev; - char name [20]; + char name[64]; int id; if (down_interruptible (&dvbdev_register_lock)) @@ -222,6 +223,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, list_add_tail (&dvbdev->list_head, &adap->device_list); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) snprintf(name, sizeof(name), "%s%d", dnames[type], id); dvbdev->devfs_handle = devfs_register(adap->devfs_handle, name, DEVFS_FL_DEFAULT, @@ -229,7 +231,15 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, nums2minor(adap->num, type, id), S_IFCHR | S_IRUSR | S_IWUSR, dvbdev->fops, dvbdev); - +#else + snprintf(name, sizeof(name), "dvb/adapter%d/%s%d", adap->num, dnames[type], id); + dvbdev->devfs_handle = devfs_register(NULL, name, + DEVFS_FL_DEFAULT, + DVB_MAJOR, + nums2minor(adap->num, type, id), + S_IFCHR | S_IRUSR | S_IWUSR, + dvbdev->fops, dvbdev); +#endif dprintk("DVB: register adapter%d/%s @ minor: %i (0x%02x)\n", adap->num, name, nums2minor(adap->num, type, id), nums2minor(adap->num, type, id)); @@ -240,10 +250,22 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, void dvb_unregister_device(struct dvb_device *dvbdev) { +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + char name[64]; + struct dvb_adapter *adap = dvbdev->adapter; +#endif + if (!dvbdev) return; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) devfs_unregister(dvbdev->devfs_handle); +#else + snprintf(name, sizeof(name), "dvb/adapter%d/%s%d", adap->num, dnames[dvbdev->type], dvbdev->id); + /* fixme */ + printk("dvb_unregister_device: %s\n",name); + devfs_remove(name); +#endif list_del (&dvbdev->list_head); kfree (dvbdev); } @@ -273,7 +295,7 @@ skip: int dvb_register_adapter(struct dvb_adapter **padap, const char *name) { - char dirname[10]; + char dirname[64]; struct dvb_adapter *adap; int num; @@ -293,13 +315,15 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name) memset (adap, 0, sizeof(struct dvb_adapter)); INIT_LIST_HEAD (&adap->device_list); - /* fixme: is this correct? */ - try_module_get(THIS_MODULE); - printk ("DVB: registering new adapter (%s).\n", name); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) snprintf(dirname, sizeof(dirname), "adapter%d", num); adap->devfs_handle = devfs_mk_dir(dvb_devfs_handle, dirname, NULL); +#else + snprintf(dirname, sizeof(dirname), "dvb/adapter%d", num); + devfs_mk_dir(dirname); +#endif adap->num = num; adap->name = name; @@ -313,14 +337,18 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name) int dvb_unregister_adapter(struct dvb_adapter *adap) { - devfs_unregister (adap->devfs_handle); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) + devfs_unregister(adap->devfs_handle); +#else + char dirname[64]; /* fixme */ + snprintf(dirname, sizeof(dirname), "dvb/adapter%d", adap->num); + devfs_remove(dirname); +#endif if (down_interruptible (&dvbdev_register_lock)) return -ERESTARTSYS; list_del (&adap->list_head); up (&dvbdev_register_lock); kfree (adap); - /* fixme: is this correct? */ - module_put(THIS_MODULE); return 0; } @@ -328,7 +356,11 @@ int dvb_unregister_adapter(struct dvb_adapter *adap) static int __init init_dvbdev(void) { +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) dvb_devfs_handle = devfs_mk_dir (NULL, "dvb", NULL); +#else + devfs_mk_dir("dvb"); +#endif #ifndef CONFIG_DVB_DEVFS_ONLY if(register_chrdev(DVB_MAJOR,"DVB", &dvb_device_fops)) { printk("video_dev: unable to get major %d\n", DVB_MAJOR); @@ -345,7 +377,11 @@ void __exit exit_dvbdev(void) #ifndef CONFIG_DVB_DEVFS_ONLY unregister_chrdev(DVB_MAJOR, "DVB"); #endif - devfs_unregister(dvb_devfs_handle); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) + devfs_unregister(dvb_devfs_handle); +#else + devfs_remove("dvb"); +#endif } module_init(init_dvbdev); |