summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core/dvbdev.c
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2003-05-06 14:25:56 +0000
committerMichael Hunold <devnull@localhost>2003-05-06 14:25:56 +0000
commit48e25cdc73a979d86cceeebd9d64918130f9079f (patch)
tree71671e744b30e18a90cf424721881886a7d64229 /linux/drivers/media/dvb/dvb-core/dvbdev.c
parent15ee2f4af37d50903ab258fdb8b679478e7f179c (diff)
downloadmediapointer-dvb-s2-48e25cdc73a979d86cceeebd9d64918130f9079f.tar.gz
mediapointer-dvb-s2-48e25cdc73a979d86cceeebd9d64918130f9079f.tar.bz2
Make the dvb-core compile again under 2.5.69. This time I made it the
dirty way, using #ifdef(LINUX_VERSION) stuff, because devfs changes in 2.5 are likely to happen again. This should be cleaned up.
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core/dvbdev.c')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvbdev.c58
1 files changed, 47 insertions, 11 deletions
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);