summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-10-28 01:27:37 +0000
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-28 01:27:37 +0000
commit3406a0aa7630cd74e82a090e2c2c9b2f00152481 (patch)
tree20ae82df9662f88037f900ee57c869ab2abaf329 /linux/drivers/media/dvb/dvb-core
parentdec32b6f66df644e81cc7fba05f7ed7f6d4316cd (diff)
downloadmediapointer-dvb-s2-3406a0aa7630cd74e82a090e2c2c9b2f00152481.tar.gz
mediapointer-dvb-s2-3406a0aa7630cd74e82a090e2c2c9b2f00152481.tar.bz2
add DVB_DEVICE_NUM and DVB_ADAPTER_NUM to uevent
From: Kay Sievers <kay.sievers@vrfy.org> This allows udev to create proper device nodes without any hacky shell scripts/programs to call, which guess these numbers from the kernel device names. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvbdev.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c
index a35286f1a..59a65a8c3 100644
--- a/linux/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c
@@ -262,11 +262,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27)
clsdev = device_create(dvb_class, adap->device,
MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
- NULL, "dvb%d.%s%d", adap->num, dnames[type], id);
+ dvbdev, "dvb%d.%s%d", adap->num, dnames[type], id);
#elif LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 27)
clsdev = device_create_drvdata(dvb_class, adap->device,
MKDEV(DVB_MAJOR, minor),
- NULL, "dvb%d.%s%d", adap->num, dnames[type], id);
+ dvbdev, "dvb%d.%s%d", adap->num, dnames[type], id);
#else
clsdev = device_create(dvb_class, adap->device,
MKDEV(DVB_MAJOR, minor),
@@ -451,6 +451,17 @@ out:
return err;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+ struct dvb_device *dvbdev = dev_get_drvdata(dev);
+
+ add_uevent_var(env, "DVB_DEVICE_NUM=%d", dvbdev->id);
+ add_uevent_var(env, "DVB_ADAPTER_NUM=%d", dvbdev->adapter->num);
+ return 0;
+}
+#endif
+
static int __init init_dvbdev(void)
{
int retval;
@@ -477,6 +488,9 @@ static int __init init_dvbdev(void)
retval = PTR_ERR(dvb_class);
goto error;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+ dvb_class->dev_uevent = dvb_uevent;
+#endif
return 0;
error: