aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2007-06-08 18:46:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:10 -0400
commit44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch)
tree6e16d3ec80c87490dc743f72da086356f2906ace /sound/pci
parentb8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (diff)
PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision ID, they can now use the pci_device->revision member. This exposes some issues where drivers where reading a word or a dword for the revision number, and adding useless error-handling around the read. Some drivers even just read it for no purpose of all. In devices where the revision ID is being copied over and used in what appears to be the equivalent of hotpath, I have left the copy code and the cached copy as not to influence the driver's performance. Compile tested with make all{yes,mod}config on x86_64 and i386. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Acked-by: Dave Jones <davej@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ali5451/ali5451.c2
-rw-r--r--sound/pci/atiixp.c6
-rw-r--r--sound/pci/atiixp_modem.c5
-rw-r--r--sound/pci/au88x0/au88x0.c6
-rw-r--r--sound/pci/ca0106/ca0106.h1
-rw-r--r--sound/pci/ca0106/ca0106_main.c5
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c4
-rw-r--r--sound/pci/emu10k1/emu10k1x.c2
-rw-r--r--sound/pci/ens1370.c4
-rw-r--r--sound/pci/fm801.c4
-rw-r--r--sound/pci/via82xx.c14
-rw-r--r--sound/pci/via82xx_modem.c4
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c2
13 files changed, 19 insertions, 40 deletions
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index cb59f994c68f..41543a4933e7 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2218,7 +2218,7 @@ static int __devinit snd_ali_create(struct snd_card *card,
2218 codec->card = card; 2218 codec->card = card;
2219 codec->pci = pci; 2219 codec->pci = pci;
2220 codec->irq = -1; 2220 codec->irq = -1;
2221 pci_read_config_byte(pci, PCI_REVISION_ID, &codec->revision); 2221 codec->revision = pci->revision;
2222 codec->spdif_support = spdif_support; 2222 codec->spdif_support = spdif_support;
2223 2223
2224 if (pcm_streams < 1) 2224 if (pcm_streams < 1)
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 7d8053b5e8d5..89184a424140 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1639,15 +1639,12 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1639{ 1639{
1640 struct snd_card *card; 1640 struct snd_card *card;
1641 struct atiixp *chip; 1641 struct atiixp *chip;
1642 unsigned char revision;
1643 int err; 1642 int err;
1644 1643
1645 card = snd_card_new(index, id, THIS_MODULE, 0); 1644 card = snd_card_new(index, id, THIS_MODULE, 0);
1646 if (card == NULL) 1645 if (card == NULL)
1647 return -ENOMEM; 1646 return -ENOMEM;
1648 1647
1649 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
1650
1651 strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); 1648 strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
1652 strcpy(card->shortname, "ATI IXP"); 1649 strcpy(card->shortname, "ATI IXP");
1653 if ((err = snd_atiixp_create(card, pci, &chip)) < 0) 1650 if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
@@ -1670,7 +1667,8 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1670 snd_atiixp_chip_start(chip); 1667 snd_atiixp_chip_start(chip);
1671 1668
1672 snprintf(card->longname, sizeof(card->longname), 1669 snprintf(card->longname, sizeof(card->longname),
1673 "%s rev %x with %s at %#lx, irq %i", card->shortname, revision, 1670 "%s rev %x with %s at %#lx, irq %i", card->shortname,
1671 pci->revision,
1674 chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?", 1672 chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?",
1675 chip->addr, chip->irq); 1673 chip->addr, chip->irq);
1676 1674
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 904023fe4f26..ce752f84457a 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1283,15 +1283,12 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1283{ 1283{
1284 struct snd_card *card; 1284 struct snd_card *card;
1285 struct atiixp_modem *chip; 1285 struct atiixp_modem *chip;
1286 unsigned char revision;
1287 int err; 1286 int err;
1288 1287
1289 card = snd_card_new(index, id, THIS_MODULE, 0); 1288 card = snd_card_new(index, id, THIS_MODULE, 0);
1290 if (card == NULL) 1289 if (card == NULL)
1291 return -ENOMEM; 1290 return -ENOMEM;
1292 1291
1293 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
1294
1295 strcpy(card->driver, "ATIIXP-MODEM"); 1292 strcpy(card->driver, "ATIIXP-MODEM");
1296 strcpy(card->shortname, "ATI IXP Modem"); 1293 strcpy(card->shortname, "ATI IXP Modem");
1297 if ((err = snd_atiixp_create(card, pci, &chip)) < 0) 1294 if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
@@ -1312,7 +1309,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1312 snd_atiixp_chip_start(chip); 1309 snd_atiixp_chip_start(chip);
1313 1310
1314 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i", 1311 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i",
1315 card->shortname, revision, chip->addr, chip->irq); 1312 card->shortname, pci->revision, chip->addr, chip->irq);
1316 1313
1317 if ((err = snd_card_register(card)) < 0) 1314 if ((err = snd_card_register(card)) < 0)
1318 goto __error; 1315 goto __error;
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index 238154bb7a25..5ec1b6fcd548 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -341,11 +341,7 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
341 snd_card_free(card); 341 snd_card_free(card);
342 return err; 342 return err;
343 } 343 }
344 if ((err = pci_read_config_byte(pci, PCI_REVISION_ID, 344 chip->rev = pci->revision;
345 &(chip->rev))) < 0) {
346 snd_card_free(card);
347 return err;
348 }
349#ifdef CHIP_AU8830 345#ifdef CHIP_AU8830
350 if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) { 346 if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {
351 printk(KERN_ALERT 347 printk(KERN_ALERT
diff --git a/sound/pci/ca0106/ca0106.h b/sound/pci/ca0106/ca0106.h
index aaac6e5b4767..a0420bc63f0b 100644
--- a/sound/pci/ca0106/ca0106.h
+++ b/sound/pci/ca0106/ca0106.h
@@ -590,7 +590,6 @@ struct snd_ca0106 {
590 struct resource *res_port; 590 struct resource *res_port;
591 int irq; 591 int irq;
592 592
593 unsigned char revision; /* chip revision */
594 unsigned int serial; /* serial number */ 593 unsigned int serial; /* serial number */
595 unsigned short model; /* subsystem id */ 594 unsigned short model; /* subsystem id */
596 595
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 48f3f17c5170..9fd7b8a5b75e 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1293,13 +1293,12 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
1293 } 1293 }
1294 1294
1295 pci_set_master(pci); 1295 pci_set_master(pci);
1296 /* read revision & serial */ 1296 /* read serial */
1297 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision);
1298 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 1297 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
1299 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 1298 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
1300#if 1 1299#if 1
1301 printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model, 1300 printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model,
1302 chip->revision, chip->serial); 1301 pci->revision, chip->serial);
1303#endif 1302#endif
1304 strcpy(card->driver, "CA0106"); 1303 strcpy(card->driver, "CA0106");
1305 strcpy(card->shortname, "CA0106"); 1304 strcpy(card->shortname, "CA0106");
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index dbc805c33fc4..4a9b59ad8ab1 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1511,7 +1511,6 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1511 struct snd_emu10k1 *emu; 1511 struct snd_emu10k1 *emu;
1512 int idx, err; 1512 int idx, err;
1513 int is_audigy; 1513 int is_audigy;
1514 unsigned char revision;
1515 unsigned int silent_page; 1514 unsigned int silent_page;
1516 const struct snd_emu_chip_details *c; 1515 const struct snd_emu_chip_details *c;
1517 static struct snd_device_ops ops = { 1516 static struct snd_device_ops ops = {
@@ -1543,8 +1542,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1543 emu->synth = NULL; 1542 emu->synth = NULL;
1544 emu->get_synth_voice = NULL; 1543 emu->get_synth_voice = NULL;
1545 /* read revision & serial */ 1544 /* read revision & serial */
1546 pci_read_config_byte(pci, PCI_REVISION_ID, &revision); 1545 emu->revision = pci->revision;
1547 emu->revision = revision;
1548 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); 1546 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
1549 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); 1547 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
1550 snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model); 1548 snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model);
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index bb0fec7f7e1b..e4af7a9b808c 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -942,7 +942,7 @@ static int __devinit snd_emu10k1x_create(struct snd_card *card,
942 942
943 pci_set_master(pci); 943 pci_set_master(pci);
944 /* read revision & serial */ 944 /* read revision & serial */
945 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision); 945 chip->revision = pci->revision;
946 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 946 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
947 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 947 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
948 snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model, 948 snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model,
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 6a0ddcf00884..7c403965153b 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2110,7 +2110,6 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
2110 struct ensoniq ** rensoniq) 2110 struct ensoniq ** rensoniq)
2111{ 2111{
2112 struct ensoniq *ensoniq; 2112 struct ensoniq *ensoniq;
2113 unsigned char cmdb;
2114 int err; 2113 int err;
2115 static struct snd_device_ops ops = { 2114 static struct snd_device_ops ops = {
2116 .dev_free = snd_ensoniq_dev_free, 2115 .dev_free = snd_ensoniq_dev_free,
@@ -2151,8 +2150,7 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
2151 } 2150 }
2152#endif 2151#endif
2153 pci_set_master(pci); 2152 pci_set_master(pci);
2154 pci_read_config_byte(pci, PCI_REVISION_ID, &cmdb); 2153 ensoniq->rev = pci->revision;
2155 ensoniq->rev = cmdb;
2156#ifdef CHIP1370 2154#ifdef CHIP1370
2157#if 0 2155#if 0
2158 ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE | 2156 ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 6dc578bbeec9..11015178e207 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1369,7 +1369,6 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1369 struct fm801 ** rchip) 1369 struct fm801 ** rchip)
1370{ 1370{
1371 struct fm801 *chip; 1371 struct fm801 *chip;
1372 unsigned char rev;
1373 int err; 1372 int err;
1374 static struct snd_device_ops ops = { 1373 static struct snd_device_ops ops = {
1375 .dev_free = snd_fm801_dev_free, 1374 .dev_free = snd_fm801_dev_free,
@@ -1405,8 +1404,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1405 pci_set_master(pci); 1404 pci_set_master(pci);
1406 } 1405 }
1407 1406
1408 pci_read_config_byte(pci, PCI_REVISION_ID, &rev); 1407 if (pci->revision >= 0xb1) /* FM801-AU */
1409 if (rev >= 0xb1) /* FM801-AU */
1410 chip->multichannel = 1; 1408 chip->multichannel = 1;
1411 1409
1412 snd_fm801_chip_init(chip, 0); 1410 snd_fm801_chip_init(chip, 0);
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index a28992269f5e..50c9f92cfd1b 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2431,7 +2431,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2431{ 2431{
2432 struct snd_card *card; 2432 struct snd_card *card;
2433 struct via82xx *chip; 2433 struct via82xx *chip;
2434 unsigned char revision;
2435 int chip_type = 0, card_type; 2434 int chip_type = 0, card_type;
2436 unsigned int i; 2435 unsigned int i;
2437 int err; 2436 int err;
@@ -2441,18 +2440,17 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2441 return -ENOMEM; 2440 return -ENOMEM;
2442 2441
2443 card_type = pci_id->driver_data; 2442 card_type = pci_id->driver_data;
2444 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
2445 switch (card_type) { 2443 switch (card_type) {
2446 case TYPE_CARD_VIA686: 2444 case TYPE_CARD_VIA686:
2447 strcpy(card->driver, "VIA686A"); 2445 strcpy(card->driver, "VIA686A");
2448 sprintf(card->shortname, "VIA 82C686A/B rev%x", revision); 2446 sprintf(card->shortname, "VIA 82C686A/B rev%x", pci->revision);
2449 chip_type = TYPE_VIA686; 2447 chip_type = TYPE_VIA686;
2450 break; 2448 break;
2451 case TYPE_CARD_VIA8233: 2449 case TYPE_CARD_VIA8233:
2452 chip_type = TYPE_VIA8233; 2450 chip_type = TYPE_VIA8233;
2453 sprintf(card->shortname, "VIA 823x rev%x", revision); 2451 sprintf(card->shortname, "VIA 823x rev%x", pci->revision);
2454 for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) { 2452 for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) {
2455 if (revision == via823x_cards[i].revision) { 2453 if (pci->revision == via823x_cards[i].revision) {
2456 chip_type = via823x_cards[i].type; 2454 chip_type = via823x_cards[i].type;
2457 strcpy(card->shortname, via823x_cards[i].name); 2455 strcpy(card->shortname, via823x_cards[i].name);
2458 break; 2456 break;
@@ -2460,7 +2458,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2460 } 2458 }
2461 if (chip_type != TYPE_VIA8233A) { 2459 if (chip_type != TYPE_VIA8233A) {
2462 if (dxs_support == VIA_DXS_AUTO) 2460 if (dxs_support == VIA_DXS_AUTO)
2463 dxs_support = check_dxs_list(pci, revision); 2461 dxs_support = check_dxs_list(pci, pci->revision);
2464 /* force to use VIA8233 or 8233A model according to 2462 /* force to use VIA8233 or 8233A model according to
2465 * dxs_support module option 2463 * dxs_support module option
2466 */ 2464 */
@@ -2471,7 +2469,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2471 } 2469 }
2472 if (chip_type == TYPE_VIA8233A) 2470 if (chip_type == TYPE_VIA8233A)
2473 strcpy(card->driver, "VIA8233A"); 2471 strcpy(card->driver, "VIA8233A");
2474 else if (revision >= VIA_REV_8237) 2472 else if (pci->revision >= VIA_REV_8237)
2475 strcpy(card->driver, "VIA8237"); /* no slog assignment */ 2473 strcpy(card->driver, "VIA8237"); /* no slog assignment */
2476 else 2474 else
2477 strcpy(card->driver, "VIA8233"); 2475 strcpy(card->driver, "VIA8233");
@@ -2482,7 +2480,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2482 goto __error; 2480 goto __error;
2483 } 2481 }
2484 2482
2485 if ((err = snd_via82xx_create(card, pci, chip_type, revision, 2483 if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision,
2486 ac97_clock, &chip)) < 0) 2484 ac97_clock, &chip)) < 0)
2487 goto __error; 2485 goto __error;
2488 card->private_data = chip; 2486 card->private_data = chip;
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index b338e15db0d9..8cbf8eba4ae9 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1162,7 +1162,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1162{ 1162{
1163 struct snd_card *card; 1163 struct snd_card *card;
1164 struct via82xx_modem *chip; 1164 struct via82xx_modem *chip;
1165 unsigned char revision;
1166 int chip_type = 0, card_type; 1165 int chip_type = 0, card_type;
1167 unsigned int i; 1166 unsigned int i;
1168 int err; 1167 int err;
@@ -1172,7 +1171,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1172 return -ENOMEM; 1171 return -ENOMEM;
1173 1172
1174 card_type = pci_id->driver_data; 1173 card_type = pci_id->driver_data;
1175 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
1176 switch (card_type) { 1174 switch (card_type) {
1177 case TYPE_CARD_VIA82XX_MODEM: 1175 case TYPE_CARD_VIA82XX_MODEM:
1178 strcpy(card->driver, "VIA82XX-MODEM"); 1176 strcpy(card->driver, "VIA82XX-MODEM");
@@ -1184,7 +1182,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1184 goto __error; 1182 goto __error;
1185 } 1183 }
1186 1184
1187 if ((err = snd_via82xx_create(card, pci, chip_type, revision, 1185 if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision,
1188 ac97_clock, &chip)) < 0) 1186 ac97_clock, &chip)) < 0)
1189 goto __error; 1187 goto __error;
1190 card->private_data = chip; 1188 card->private_data = chip;
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index ea861bceaddf..ab7a81c35705 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2404,7 +2404,7 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
2404 chip->pci = pci; 2404 chip->pci = pci;
2405 chip->irq = -1; 2405 chip->irq = -1;
2406 chip->device_id = pci->device; 2406 chip->device_id = pci->device;
2407 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->rev); 2407 chip->rev = pci->revision;
2408 chip->reg_area_phys = pci_resource_start(pci, 0); 2408 chip->reg_area_phys = pci_resource_start(pci, 0);
2409 chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000); 2409 chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000);
2410 pci_set_master(pci); 2410 pci_set_master(pci);