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 | |
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')
-rw-r--r-- | drivers/media/dvb/b2c2/flexcop.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/bt8xx/dvb-bt8xx.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/cinergyT2/cinergyT2.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.c | 5 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/pluto2/pluto2.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-core.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttusb-dec/ttusb_dec.c | 2 |
11 files changed, 15 insertions, 12 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 56ba52470676..5c276b3793ea 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c | |||
@@ -67,7 +67,7 @@ static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
67 | static int flexcop_dvb_init(struct flexcop_device *fc) | 67 | static int flexcop_dvb_init(struct flexcop_device *fc) |
68 | { | 68 | { |
69 | int ret; | 69 | int ret; |
70 | if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner)) < 0) { | 70 | if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner,fc->dev)) < 0) { |
71 | err("error registering DVB adapter"); | 71 | err("error registering DVB adapter"); |
72 | return ret; | 72 | return ret; |
73 | } | 73 | } |
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index ccc7b2eb4a2d..1bf3392ac80d 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c | |||
@@ -713,7 +713,7 @@ static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | |||
713 | { | 713 | { |
714 | int result; | 714 | int result; |
715 | 715 | ||
716 | if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE)) < 0) { | 716 | if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE, &card->bt->dev->dev)) < 0) { |
717 | printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); | 717 | printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); |
718 | return result; | 718 | return result; |
719 | } | 719 | } |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 9325d039ea65..c7e4134872d4 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -902,7 +902,7 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
902 | return -ENOMEM; | 902 | return -ENOMEM; |
903 | } | 903 | } |
904 | 904 | ||
905 | if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE)) < 0) { | 905 | if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev)) < 0) { |
906 | kfree(cinergyt2); | 906 | kfree(cinergyt2); |
907 | return err; | 907 | return err; |
908 | } | 908 | } |
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, |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c index 6fa92100248b..500896d02d5a 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | |||
@@ -82,7 +82,7 @@ int dvb_usb_dvb_init(struct dvb_usb_device *d) | |||
82 | int ret; | 82 | int ret; |
83 | 83 | ||
84 | if ((ret = dvb_register_adapter(&d->dvb_adap, d->desc->name, | 84 | if ((ret = dvb_register_adapter(&d->dvb_adap, d->desc->name, |
85 | d->owner)) < 0) { | 85 | d->owner, &d->udev->dev)) < 0) { |
86 | deb_info("dvb_register_adapter failed: error %d", ret); | 86 | deb_info("dvb_register_adapter failed: error %d", ret); |
87 | goto err; | 87 | goto err; |
88 | } | 88 | } |
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index 1c5316e209ef..c9afad038c1f 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c | |||
@@ -647,7 +647,7 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, | |||
647 | goto err_pluto_hw_exit; | 647 | goto err_pluto_hw_exit; |
648 | 648 | ||
649 | /* dvb */ | 649 | /* dvb */ |
650 | ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE); | 650 | ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev); |
651 | if (ret < 0) | 651 | if (ret < 0) |
652 | goto err_i2c_bit_del_bus; | 652 | goto err_i2c_bit_del_bus; |
653 | 653 | ||
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index d028245c8eed..21e331d32ca1 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -2413,7 +2413,7 @@ static int __devinit av7110_attach(struct saa7146_dev* dev, | |||
2413 | goto err_kfree_0; | 2413 | goto err_kfree_0; |
2414 | 2414 | ||
2415 | ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name, | 2415 | ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name, |
2416 | THIS_MODULE); | 2416 | THIS_MODULE, &dev->pci->dev); |
2417 | if (ret < 0) | 2417 | if (ret < 0) |
2418 | goto err_put_firmware_1; | 2418 | goto err_put_firmware_1; |
2419 | 2419 | ||
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c index d8af690fa55c..e4cf7775e07f 100644 --- a/drivers/media/dvb/ttpci/budget-core.c +++ b/drivers/media/dvb/ttpci/budget-core.c | |||
@@ -400,7 +400,7 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, | |||
400 | budget->dev->name, budget->buffer_width, budget->buffer_height); | 400 | budget->dev->name, budget->buffer_width, budget->buffer_height); |
401 | printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size); | 401 | printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size); |
402 | 402 | ||
403 | if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner)) < 0) { | 403 | if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev)) < 0) { |
404 | return ret; | 404 | return ret; |
405 | } | 405 | } |
406 | 406 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 6ceae38125c7..95558608b03e 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1507,7 +1507,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1507 | 1507 | ||
1508 | mutex_unlock(&ttusb->semi2c); | 1508 | mutex_unlock(&ttusb->semi2c); |
1509 | 1509 | ||
1510 | if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE)) < 0) { | 1510 | if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev)) < 0) { |
1511 | ttusb_free_iso_urbs(ttusb); | 1511 | ttusb_free_iso_urbs(ttusb); |
1512 | kfree(ttusb); | 1512 | kfree(ttusb); |
1513 | return result; | 1513 | return result; |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 44dea3211848..da1090afad54 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -1432,7 +1432,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) | |||
1432 | dprintk("%s\n", __FUNCTION__); | 1432 | dprintk("%s\n", __FUNCTION__); |
1433 | 1433 | ||
1434 | if ((result = dvb_register_adapter(&dec->adapter, | 1434 | if ((result = dvb_register_adapter(&dec->adapter, |
1435 | dec->model_name, THIS_MODULE)) < 0) { | 1435 | dec->model_name, THIS_MODULE, &dec->udev->dev)) < 0) { |
1436 | printk("%s: dvb_register_adapter failed: error %d\n", | 1436 | printk("%s: dvb_register_adapter failed: error %d\n", |
1437 | __FUNCTION__, result); | 1437 | __FUNCTION__, result); |
1438 | 1438 | ||