diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2007-06-08 18:46:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:02:10 -0400 |
commit | 44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch) | |
tree | 6e16d3ec80c87490dc743f72da086356f2906ace /sound/pci/via82xx.c | |
parent | b8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (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/via82xx.c')
-rw-r--r-- | sound/pci/via82xx.c | 14 |
1 files changed, 6 insertions, 8 deletions
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; |