diff options
author | Andrew de Quincy <devnull@localhost> | 2005-01-22 12:40:57 +0000 |
---|---|---|
committer | Andrew de Quincy <devnull@localhost> | 2005-01-22 12:40:57 +0000 |
commit | 2fc85a3ccf65e064411f26b63a7ae8dedf31c920 (patch) | |
tree | f7ac16f922e0329a61af16d3d73bee03c9683e6b /linux/drivers/media | |
parent | e9c01b13d8e10720a867d548b01cc061515161dc (diff) | |
download | mediapointer-dvb-s2-2fc85a3ccf65e064411f26b63a7ae8dedf31c920.tar.gz mediapointer-dvb-s2-2fc85a3ccf65e064411f26b63a7ae8dedf31c920.tar.bz2 |
Added support for up to six DVB devices
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 14637f09c..0e6fe8139 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -31,6 +31,8 @@ #include <linux/init.h> #include <linux/slab.h> #include <linux/device.h> +#include <linux/fs.h> +#include <linux/cdev.h> #include "dvbdev.h" @@ -49,8 +51,9 @@ static const char * const dnames[] = { "net", "osd" }; -#define DVB_MAX_IDS 4 +#define DVB_MAX_IDS 6 #define nums2minor(num,type,id) ((num << 6) | (id << 4) | type) +#define MAX_DVB_MINORS (DVB_MAX_IDS*64) struct class_simple *dvb_class; EXPORT_SYMBOL(dvb_class); @@ -107,6 +110,11 @@ static struct file_operations dvb_device_fops = .open = dvb_device_open, }; +static struct cdev dvb_device_cdev = { + .kobj = {.name = "dvb", }, + .owner = THIS_MODULE, +}; + int dvb_generic_open(struct inode *inode, struct file *file) { struct dvb_device *dvbdev = file->private_data; @@ -397,25 +405,41 @@ out: static int __init init_dvbdev(void) { int retval; + dev_t dev = MKDEV(DVB_MAJOR, 0); + + if ((retval = register_chrdev_region(dev, MAX_DVB_MINORS, "DVB")) != 0) { + printk("dvb-core: unable to get major %d\n", DVB_MAJOR); + return retval; + } - if ((retval = register_chrdev(DVB_MAJOR,"DVB", &dvb_device_fops))) + cdev_init(&dvb_device_cdev, &dvb_device_fops); + if ((retval = cdev_add(&dvb_device_cdev, dev, MAX_DVB_MINORS)) != 0) { printk("dvb-core: unable to get major %d\n", DVB_MAJOR); + goto error; + } devfs_mk_dir("dvb"); dvb_class = class_simple_create(THIS_MODULE, "dvb"); - if (IS_ERR(dvb_class)) - return PTR_ERR(dvb_class); + if (IS_ERR(dvb_class)) { + retval = PTR_ERR(dvb_class); + goto error; + } + return 0; +error: + cdev_del(&dvb_device_cdev); + unregister_chrdev_region(dev, MAX_DVB_MINORS); return retval; } static void __exit exit_dvbdev(void) { - unregister_chrdev(DVB_MAJOR, "DVB"); devfs_remove("dvb"); class_simple_destroy(dvb_class); + cdev_del(&dvb_device_cdev); + unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); } module_init(init_dvbdev); |