diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-04-10 08:27:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:57:55 -0400 |
commit | d09dbf92ada861244056d914a8f68b8be99891ed (patch) | |
tree | 3746d352f1d3df6a069c7b740717706ec50a1981 /drivers/media/dvb/dvb-core | |
parent | 76d313bfea356550a614be51454d526e5090014d (diff) |
V4L/DVB (3762): Add sysfs device links to dvb devices
Currently in /sys/class/dvb/dvbX.demuxY/ we have:
dev
uevent
With the patch, we have (for a PCI DVB device):
dev
device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:03:0d.0
uevent
So userspace tools can (finally) work out which physical device a DVB adapter
refers to. Previously you had to kinda look through dmesg and hope that it
hadn't been dumped out of the buffer. This makes debugging a lot easier if
the system has been up for a long time!
This is done by adding an extra 'struct device *' parameter to
dvb_register_adapter(). It will work with any kind of standard
linux 'device'. Additionally, if someone has an embedded system which does
things differently, they can simply supply 'NULL' and the behaviour will be
as before - the link will simply not appear.
Ack'd-by: Manu Abraham <manu@linuxtv.org>
Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-core')
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.c | 5 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.h | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 3852430d0260..134c2bbbeeb5 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -236,7 +236,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
236 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); | 236 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); |
237 | 237 | ||
238 | class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), | 238 | class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), |
239 | NULL, "dvb%d.%s%d", adap->num, dnames[type], id); | 239 | adap->device, "dvb%d.%s%d", adap->num, dnames[type], id); |
240 | 240 | ||
241 | dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", | 241 | dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", |
242 | adap->num, dnames[type], id, nums2minor(adap->num, type, id), | 242 | adap->num, dnames[type], id, nums2minor(adap->num, type, id), |
@@ -285,7 +285,7 @@ skip: | |||
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct module *module) | 288 | int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct module *module, struct device *device) |
289 | { | 289 | { |
290 | int num; | 290 | int num; |
291 | 291 | ||
@@ -306,6 +306,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu | |||
306 | adap->num = num; | 306 | adap->num = num; |
307 | adap->name = name; | 307 | adap->name = name; |
308 | adap->module = module; | 308 | adap->module = module; |
309 | adap->device = device; | ||
309 | 310 | ||
310 | list_add_tail (&adap->list_head, &dvb_adapter_list); | 311 | list_add_tail (&adap->list_head, &dvb_adapter_list); |
311 | 312 | ||
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 74ed5853f0fb..d7a976d040d7 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h | |||
@@ -51,6 +51,8 @@ struct dvb_adapter { | |||
51 | u8 proposed_mac [6]; | 51 | u8 proposed_mac [6]; |
52 | void* priv; | 52 | void* priv; |
53 | 53 | ||
54 | struct device *device; | ||
55 | |||
54 | struct module *module; | 56 | struct module *module; |
55 | }; | 57 | }; |
56 | 58 | ||
@@ -76,7 +78,7 @@ struct dvb_device { | |||
76 | }; | 78 | }; |
77 | 79 | ||
78 | 80 | ||
79 | extern int dvb_register_adapter (struct dvb_adapter *adap, const char *name, struct module *module); | 81 | extern int dvb_register_adapter (struct dvb_adapter *adap, const char *name, struct module *module, struct device *device); |
80 | extern int dvb_unregister_adapter (struct dvb_adapter *adap); | 82 | extern int dvb_unregister_adapter (struct dvb_adapter *adap); |
81 | 83 | ||
82 | extern int dvb_register_device (struct dvb_adapter *adap, | 84 | extern int dvb_register_device (struct dvb_adapter *adap, |