aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-01-21 10:15:19 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:05:22 -0500
commit386900781205d203c1141d3e2dae759f1b531193 (patch)
tree2bad1d976d3ce0cfb33766b3ed4cf9613a131a70 /drivers/media
parent4a2b108379743405bc488eaef6a75080aa1bbba4 (diff)
V4L/DVB (7077): bt878: remove handcrafted PCI subsystem ID check
This patch moves the subsystem ID and subsystem vendor ID check from probing function to the PCI generic function by describing subsystem IDs in pci_device_id table. This enables to add new PCI IDs to a device driver pci_ids table at runtime by new_id file in sysfs pci driver tree. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/bt8xx/bt878.c76
-rw-r--r--drivers/media/dvb/bt8xx/bt878.h6
2 files changed, 33 insertions, 49 deletions
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index 85e36a1d6d78..c7bbb40223f5 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -378,23 +378,37 @@ bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *
378 378
379EXPORT_SYMBOL(bt878_device_control); 379EXPORT_SYMBOL(bt878_device_control);
380 380
381#define BROOKTREE_878_DEVICE(vend, dev, name) \
382 { \
383 .vendor = PCI_VENDOR_ID_BROOKTREE, \
384 .device = PCI_DEVICE_ID_BROOKTREE_878, \
385 .subvendor = (vend), .subdevice = (dev), \
386 .driver_data = (unsigned long) name \
387 }
381 388
382static struct cards card_list[] __devinitdata = { 389static struct pci_device_id bt878_pci_tbl[] __devinitdata = {
383 390 BROOKTREE_878_DEVICE(0x0071, 0x0101, "Nebula Electronics DigiTV"),
384 { 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" }, 391 BROOKTREE_878_DEVICE(0x1461, 0x0761, "AverMedia AverTV DVB-T 761"),
385 { 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" }, 392 BROOKTREE_878_DEVICE(0x11bd, 0x001c, "Pinnacle PCTV Sat"),
386 { 0x001c11bd, BTTV_BOARD_PINNACLESAT, "Pinnacle PCTV Sat" }, 393 BROOKTREE_878_DEVICE(0x11bd, 0x0026, "Pinnacle PCTV SAT CI"),
387 { 0x002611bd, BTTV_BOARD_TWINHAN_DST, "Pinnacle PCTV SAT CI" }, 394 BROOKTREE_878_DEVICE(0x1822, 0x0001, "Twinhan VisionPlus DVB"),
388 { 0x00011822, BTTV_BOARD_TWINHAN_DST, "Twinhan VisionPlus DVB" }, 395 BROOKTREE_878_DEVICE(0x270f, 0xfc00,
389 { 0xfc00270f, BTTV_BOARD_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" }, 396 "ChainTech digitop DST-1000 DVB-S"),
390 { 0x07711461, BTTV_BOARD_AVDVBT_771, "AVermedia AverTV DVB-T 771" }, 397 BROOKTREE_878_DEVICE(0x1461, 0x0771, "AVermedia AverTV DVB-T 771"),
391 { 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" }, 398 BROOKTREE_878_DEVICE(0x18ac, 0xdb10, "DViCO FusionHDTV DVB-T Lite"),
392 { 0xdb1118ac, BTTV_BOARD_DVICO_DVBT_LITE, "Ultraview DVB-T Lite" }, 399 BROOKTREE_878_DEVICE(0x18ac, 0xdb11, "Ultraview DVB-T Lite"),
393 { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" }, 400 BROOKTREE_878_DEVICE(0x18ac, 0xd500, "DViCO FusionHDTV 5 Lite"),
394 { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV" }, 401 BROOKTREE_878_DEVICE(0x7063, 0x2000, "pcHDTV HD-2000 TV"),
395 { 0x00261822, BTTV_BOARD_TWINHAN_DST, "DNTV Live! Mini" } 402 BROOKTREE_878_DEVICE(0x1822, 0x0026, "DNTV Live! Mini"),
403 { }
396}; 404};
397 405
406MODULE_DEVICE_TABLE(pci, bt878_pci_tbl);
407
408static const char * __devinit card_name(const struct pci_device_id *id)
409{
410 return id->driver_data ? (const char *)id->driver_data : "Unknown";
411}
398 412
399/***********************/ 413/***********************/
400/* PCI device handling */ 414/* PCI device handling */
@@ -403,15 +417,13 @@ static struct cards card_list[] __devinitdata = {
403static int __devinit bt878_probe(struct pci_dev *dev, 417static int __devinit bt878_probe(struct pci_dev *dev,
404 const struct pci_device_id *pci_id) 418 const struct pci_device_id *pci_id)
405{ 419{
406 int result = 0, has_dvb = 0, i; 420 int result = 0;
407 unsigned char lat; 421 unsigned char lat;
408 struct bt878 *bt; 422 struct bt878 *bt;
409#if defined(__powerpc__) 423#if defined(__powerpc__)
410 unsigned int cmd; 424 unsigned int cmd;
411#endif 425#endif
412 unsigned int cardid; 426 unsigned int cardid;
413 unsigned short id;
414 struct cards *dvb_cards;
415 427
416 printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n", 428 printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
417 bt878_num); 429 bt878_num);
@@ -423,25 +435,11 @@ static int __devinit bt878_probe(struct pci_dev *dev,
423 if (pci_enable_device(dev)) 435 if (pci_enable_device(dev))
424 return -EIO; 436 return -EIO;
425 437
426 pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &id); 438 cardid = dev->subsystem_device << 16;
427 cardid = id << 16; 439 cardid |= dev->subsystem_vendor;
428 pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &id);
429 cardid |= id;
430
431 for (i = 0, dvb_cards = card_list; i < ARRAY_SIZE(card_list); i++, dvb_cards++) {
432 if (cardid == dvb_cards->pci_id) {
433 printk("%s: card id=[0x%x],[ %s ] has DVB functions.\n",
434 __func__, cardid, dvb_cards->name);
435 has_dvb = 1;
436 }
437 }
438 440
439 if (!has_dvb) { 441 printk(KERN_INFO "%s: card id=[0x%x],[ %s ] has DVB functions.\n",
440 printk("%s: card id=[0x%x], Unknown card.\nExiting..\n", __func__, cardid); 442 __func__, cardid, card_name(pci_id));
441 result = -EINVAL;
442
443 goto fail0;
444 }
445 443
446 bt = &bt878[bt878_num]; 444 bt = &bt878[bt878_num];
447 bt->dev = dev; 445 bt->dev = dev;
@@ -572,14 +570,6 @@ static void __devexit bt878_remove(struct pci_dev *pci_dev)
572 return; 570 return;
573} 571}
574 572
575static struct pci_device_id bt878_pci_tbl[] __devinitdata = {
576 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BROOKTREE_878,
577 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
578 {0,}
579};
580
581MODULE_DEVICE_TABLE(pci, bt878_pci_tbl);
582
583static struct pci_driver bt878_pci_driver = { 573static struct pci_driver bt878_pci_driver = {
584 .name = "bt878", 574 .name = "bt878",
585 .id_table = bt878_pci_tbl, 575 .id_table = bt878_pci_tbl,
diff --git a/drivers/media/dvb/bt8xx/bt878.h b/drivers/media/dvb/bt8xx/bt878.h
index d593bc145628..375fd2892a11 100644
--- a/drivers/media/dvb/bt8xx/bt878.h
+++ b/drivers/media/dvb/bt8xx/bt878.h
@@ -101,12 +101,6 @@
101#define BTTV_BOARD_DVICO_DVBT_LITE 0x80 101#define BTTV_BOARD_DVICO_DVBT_LITE 0x80
102#define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87 102#define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87
103 103
104struct cards {
105 __u32 pci_id;
106 __u16 card_id;
107 char *name;
108};
109
110extern int bt878_num; 104extern int bt878_num;
111 105
112struct bt878 { 106struct bt878 {