summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2004-08-06 11:23:24 +0000
committerMichael Hunold <devnull@localhost>2004-08-06 11:23:24 +0000
commit72d4781a731b791d9f3845d08139a6946c991875 (patch)
tree35d9dc2f40311da22a2f506974ac336329850a98 /linux/drivers/media/dvb
parent1cf5046919037c9bb27f223a0d531949eddfe8c5 (diff)
downloadmediapointer-dvb-s2-72d4781a731b791d9f3845d08139a6946c991875.tar.gz
mediapointer-dvb-s2-72d4781a731b791d9f3845d08139a6946c991875.tar.bz2
- add sysfs/udev support using "class_simple"
- please read the new documentation file "udev.txt" for a short description on how to create the proper udev rules
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvbdev.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c
index a41bd09f5..241cd24b4 100644
--- a/linux/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c
@@ -29,6 +29,7 @@
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/device.h>
#include "dvbdev.h"
#include "dvb_functions.h"
@@ -43,16 +44,17 @@ MODULE_PARM_DESC(dvbdev_debug, "Turn on/off device debugging (default:off).");
static LIST_HEAD(dvb_adapter_list);
static DECLARE_MUTEX(dvbdev_register_lock);
-
-static char *dnames[] = {
+static const char * const dnames[] = {
"video", "audio", "sec", "frontend", "demux", "dvr", "ca",
"net", "osd"
};
-
#define DVB_MAX_IDS 4
#define nums2minor(num,type,id) ((num << 6) | (id << 4) | type)
+struct class_simple *dvb_class;
+EXPORT_SYMBOL(dvb_class);
+
static struct dvb_device* dvbdev_find_device (int minor)
{
struct list_head *entry;
@@ -222,6 +224,9 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
S_IFCHR | S_IRUSR | S_IWUSR,
"dvb/adapter%d/%s%d", adap->num, dnames[type], id);
+ class_simple_device_add(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
+ NULL, "dvb%d.%s%d", adap->num, dnames[type], id);
+
dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
adap->num, dnames[type], id, nums2minor(adap->num, type, id),
nums2minor(adap->num, type, id));
@@ -238,6 +243,9 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
devfs_remove("dvb/adapter%d/%s%d", dvbdev->adapter->num,
dnames[dvbdev->type], dvbdev->id);
+ class_simple_device_remove(MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num,
+ dvbdev->type, dvbdev->id)));
+
list_del (&dvbdev->list_head);
kfree (dvbdev);
}
@@ -316,10 +324,15 @@ int dvb_unregister_adapter(struct dvb_adapter *adap)
static int __init init_dvbdev(void)
{
int retval;
- devfs_mk_dir("dvb");
if ((retval = register_chrdev(DVB_MAJOR,"DVB", &dvb_device_fops)))
- printk("video_dev: unable to get major %d\n", DVB_MAJOR);
+ printk("dvb-core: unable to get major %d\n", DVB_MAJOR);
+
+ devfs_mk_dir("dvb");
+
+ dvb_class = class_simple_create(THIS_MODULE, "dvb");
+ if (IS_ERR(dvb_class))
+ return PTR_ERR(dvb_class);
return retval;
}
@@ -329,6 +342,7 @@ static void __exit exit_dvbdev(void)
{
unregister_chrdev(DVB_MAJOR, "DVB");
devfs_remove("dvb");
+ class_simple_destroy(dvb_class);
}
module_init(init_dvbdev);