Commit cdc053a0 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] devfs: dvb

parent 1c6099ba
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
static int dvbdev_debug = 0; static int dvbdev_debug = 0;
#define dprintk if (dvbdev_debug) printk #define dprintk if (dvbdev_debug) printk
static devfs_handle_t dvb_devfs_handle;
static LIST_HEAD(dvb_adapter_list); static LIST_HEAD(dvb_adapter_list);
static DECLARE_MUTEX(dvbdev_register_lock); static DECLARE_MUTEX(dvbdev_register_lock);
...@@ -221,10 +220,8 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, ...@@ -221,10 +220,8 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
list_add_tail (&dvbdev->list_head, &adap->device_list); list_add_tail (&dvbdev->list_head, &adap->device_list);
sprintf(name, "dvb/adapter%d%s%d", adap->num, dnames[type], id); sprintf(name, "dvb/adapter%d%s%d", adap->num, dnames[type], id);
dvbdev->devfs_handle = devfs_register(NULL, name, 0, DVB_MAJOR, devfs_register(NULL, name, 0, DVB_MAJOR, nums2minor(adap->num, type, id),
nums2minor(adap->num, type, id), S_IFCHR | S_IRUSR | S_IWUSR, dvbdev->fops, dvbdev);
S_IFCHR | S_IRUSR | S_IWUSR,
dvbdev->fops, dvbdev);
dprintk("DVB: register adapter%d/%s @ minor: %i (0x%02x)\n", dprintk("DVB: register adapter%d/%s @ minor: %i (0x%02x)\n",
adap->num, name, nums2minor(adap->num, type, id), adap->num, name, nums2minor(adap->num, type, id),
...@@ -236,12 +233,12 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, ...@@ -236,12 +233,12 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
void dvb_unregister_device(struct dvb_device *dvbdev) void dvb_unregister_device(struct dvb_device *dvbdev)
{ {
if (!dvbdev) if (dvbdev) {
return; devfs_remove("dvb/adapter%d%s%d", dvbdev->adapter->num,
dnames[dvbdev->type], dvbdev->id);
devfs_unregister(dvbdev->devfs_handle); list_del(&dvbdev->list_head);
list_del (&dvbdev->list_head); kfree(dvbdev);
kfree (dvbdev); }
} }
...@@ -289,11 +286,12 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name) ...@@ -289,11 +286,12 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name)
INIT_LIST_HEAD (&adap->device_list); INIT_LIST_HEAD (&adap->device_list);
/* fixme: is this correct? */ /* fixme: is this correct? */
/* No */
try_module_get(THIS_MODULE); try_module_get(THIS_MODULE);
printk ("DVB: registering new adapter (%s).\n", name); printk ("DVB: registering new adapter (%s).\n", name);
adap->devfs_handle = devfs_mk_dir("dvb/adapter%d", num); devfs_mk_dir("dvb/adapter%d", num);
adap->num = num; adap->num = num;
adap->name = name; adap->name = name;
...@@ -307,13 +305,14 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name) ...@@ -307,13 +305,14 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name)
int dvb_unregister_adapter(struct dvb_adapter *adap) int dvb_unregister_adapter(struct dvb_adapter *adap)
{ {
devfs_unregister (adap->devfs_handle);
if (down_interruptible (&dvbdev_register_lock)) if (down_interruptible (&dvbdev_register_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
devfs_remove("dvb/adapter%d", adap->num);
list_del (&adap->list_head); list_del (&adap->list_head);
up (&dvbdev_register_lock); up (&dvbdev_register_lock);
kfree (adap); kfree (adap);
/* fixme: is this correct? */ /* fixme: is this correct? */
/* No. */
module_put(THIS_MODULE); module_put(THIS_MODULE);
return 0; return 0;
} }
...@@ -322,7 +321,7 @@ int dvb_unregister_adapter(struct dvb_adapter *adap) ...@@ -322,7 +321,7 @@ int dvb_unregister_adapter(struct dvb_adapter *adap)
static static
int __init init_dvbdev(void) int __init init_dvbdev(void)
{ {
dvb_devfs_handle = devfs_mk_dir ("dvb"); devfs_mk_dir("dvb");
#ifndef CONFIG_DVB_DEVFS_ONLY #ifndef CONFIG_DVB_DEVFS_ONLY
if(register_chrdev(DVB_MAJOR,"DVB", &dvb_device_fops)) { if(register_chrdev(DVB_MAJOR,"DVB", &dvb_device_fops)) {
printk("video_dev: unable to get major %d\n", DVB_MAJOR); printk("video_dev: unable to get major %d\n", DVB_MAJOR);
...@@ -339,7 +338,7 @@ void __exit exit_dvbdev(void) ...@@ -339,7 +338,7 @@ void __exit exit_dvbdev(void)
#ifndef CONFIG_DVB_DEVFS_ONLY #ifndef CONFIG_DVB_DEVFS_ONLY
unregister_chrdev(DVB_MAJOR, "DVB"); unregister_chrdev(DVB_MAJOR, "DVB");
#endif #endif
devfs_unregister(dvb_devfs_handle); devfs_remove("dvb");
} }
module_init(init_dvbdev); module_init(init_dvbdev);
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
struct dvb_adapter { struct dvb_adapter {
int num; int num;
devfs_handle_t devfs_handle;
struct list_head list_head; struct list_head list_head;
struct list_head device_list; struct list_head device_list;
const char *name; const char *name;
...@@ -55,7 +54,6 @@ struct dvb_adapter { ...@@ -55,7 +54,6 @@ struct dvb_adapter {
struct dvb_device { struct dvb_device {
struct list_head list_head; struct list_head list_head;
struct file_operations *fops; struct file_operations *fops;
devfs_handle_t devfs_handle;
struct dvb_adapter *adapter; struct dvb_adapter *adapter;
int type; int type;
u32 id; u32 id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment