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 /drivers/ide/pci | |
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 'drivers/ide/pci')
-rw-r--r-- | drivers/ide/pci/alim15x3.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/amd74xx.c | 8 | ||||
-rw-r--r-- | drivers/ide/pci/cmd64x.c | 9 | ||||
-rw-r--r-- | drivers/ide/pci/hpt366.c | 20 | ||||
-rw-r--r-- | drivers/ide/pci/piix.c | 6 | ||||
-rw-r--r-- | drivers/ide/pci/serverworks.c | 13 | ||||
-rw-r--r-- | drivers/ide/pci/sis5513.c | 8 | ||||
-rw-r--r-- | drivers/ide/pci/sl82c105.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/via82cxxx.c | 9 |
9 files changed, 22 insertions, 57 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 8a6b27b3bcc3..ba0fb92b0417 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -508,7 +508,7 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c | |||
508 | u8 tmpbyte; | 508 | u8 tmpbyte; |
509 | struct pci_dev *north = pci_get_slot(dev->bus, PCI_DEVFN(0,0)); | 509 | struct pci_dev *north = pci_get_slot(dev->bus, PCI_DEVFN(0,0)); |
510 | 510 | ||
511 | pci_read_config_byte(dev, PCI_REVISION_ID, &m5229_revision); | 511 | m5229_revision = dev->revision; |
512 | 512 | ||
513 | isa_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | 513 | isa_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); |
514 | 514 | ||
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 84ed30cdb324..8d30b99a54d8 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -123,8 +123,7 @@ static int amd74xx_get_info(char *buffer, char **addr, off_t offset, int count) | |||
123 | amd_print("Driver Version: 2.13"); | 123 | amd_print("Driver Version: 2.13"); |
124 | amd_print("South Bridge: %s", pci_name(bmide_dev)); | 124 | amd_print("South Bridge: %s", pci_name(bmide_dev)); |
125 | 125 | ||
126 | pci_read_config_byte(dev, PCI_REVISION_ID, &t); | 126 | amd_print("Revision: IDE %#x", dev->revision); |
127 | amd_print("Revision: IDE %#x", t); | ||
128 | amd_print("Highest DMA rate: UDMA%s", amd_dma[fls(amd_config->udma_mask) - 1]); | 127 | amd_print("Highest DMA rate: UDMA%s", amd_dma[fls(amd_config->udma_mask) - 1]); |
129 | 128 | ||
130 | amd_print("BM-DMA base: %#lx", amd_base); | 129 | amd_print("BM-DMA base: %#lx", amd_base); |
@@ -312,8 +311,7 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch | |||
312 | */ | 311 | */ |
313 | 312 | ||
314 | if (amd_config->flags & AMD_CHECK_SWDMA) { | 313 | if (amd_config->flags & AMD_CHECK_SWDMA) { |
315 | pci_read_config_byte(dev, PCI_REVISION_ID, &t); | 314 | if (dev->revision <= 7) |
316 | if (t <= 7) | ||
317 | amd_config->flags |= AMD_BAD_SWDMA; | 315 | amd_config->flags |= AMD_BAD_SWDMA; |
318 | } | 316 | } |
319 | 317 | ||
@@ -383,7 +381,7 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch | |||
383 | 381 | ||
384 | pci_read_config_byte(dev, PCI_REVISION_ID, &t); | 382 | pci_read_config_byte(dev, PCI_REVISION_ID, &t); |
385 | printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n", | 383 | printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n", |
386 | amd_chipset->name, pci_name(dev), t, | 384 | amd_chipset->name, pci_name(dev), dev->revision, |
387 | amd_dma[fls(amd_config->udma_mask) - 1]); | 385 | amd_dma[fls(amd_config->udma_mask) - 1]); |
388 | 386 | ||
389 | /* | 387 | /* |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 8631b6c8aa15..1e89dd6e5bbf 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -88,7 +88,6 @@ static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index) | |||
88 | u8 reg72 = 0, reg73 = 0; /* primary */ | 88 | u8 reg72 = 0, reg73 = 0; /* primary */ |
89 | u8 reg7a = 0, reg7b = 0; /* secondary */ | 89 | u8 reg7a = 0, reg7b = 0; /* secondary */ |
90 | u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */ | 90 | u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */ |
91 | u8 rev = 0; | ||
92 | 91 | ||
93 | p += sprintf(p, "\nController: %d\n", index); | 92 | p += sprintf(p, "\nController: %d\n", index); |
94 | p += sprintf(p, "PCI-%x Chipset.\n", dev->device); | 93 | p += sprintf(p, "PCI-%x Chipset.\n", dev->device); |
@@ -103,9 +102,8 @@ static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index) | |||
103 | (void) pci_read_config_byte(dev, UDIDETCR1, ®7b); | 102 | (void) pci_read_config_byte(dev, UDIDETCR1, ®7b); |
104 | 103 | ||
105 | /* PCI0643/6 originally didn't have the primary channel enable bit */ | 104 | /* PCI0643/6 originally didn't have the primary channel enable bit */ |
106 | (void) pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | ||
107 | if ((dev->device == PCI_DEVICE_ID_CMD_643) || | 105 | if ((dev->device == PCI_DEVICE_ID_CMD_643) || |
108 | (dev->device == PCI_DEVICE_ID_CMD_646 && rev < 3)) | 106 | (dev->device == PCI_DEVICE_ID_CMD_646 && dev->revision < 3)) |
109 | reg51 |= CNTRL_ENA_1ST; | 107 | reg51 |= CNTRL_ENA_1ST; |
110 | 108 | ||
111 | p += sprintf(p, "---------------- Primary Channel " | 109 | p += sprintf(p, "---------------- Primary Channel " |
@@ -604,14 +602,11 @@ static int __devinit init_setup_cmd64x(struct pci_dev *dev, ide_pci_device_t *d) | |||
604 | 602 | ||
605 | static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d) | 603 | static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d) |
606 | { | 604 | { |
607 | u8 rev = 0; | ||
608 | |||
609 | /* | 605 | /* |
610 | * The original PCI0646 didn't have the primary channel enable bit, | 606 | * The original PCI0646 didn't have the primary channel enable bit, |
611 | * it appeared starting with PCI0646U (i.e. revision ID 3). | 607 | * it appeared starting with PCI0646U (i.e. revision ID 3). |
612 | */ | 608 | */ |
613 | pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | 609 | if (dev->revision < 3) |
614 | if (rev < 3) | ||
615 | d->enablebits[0].reg = 0; | 610 | d->enablebits[0].reg = 0; |
616 | 611 | ||
617 | return ide_setup_pci_device(dev, d); | 612 | return ide_setup_pci_device(dev, d); |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 4b6bae8eee82..e9b07a97c340 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -1413,11 +1413,9 @@ static int __devinit init_setup_hpt372n(struct pci_dev *dev, ide_pci_device_t *d | |||
1413 | static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) | 1413 | static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) |
1414 | { | 1414 | { |
1415 | struct hpt_info *info; | 1415 | struct hpt_info *info; |
1416 | u8 rev = 0, mcr1 = 0; | 1416 | u8 mcr1 = 0; |
1417 | 1417 | ||
1418 | pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | 1418 | if (dev->revision > 1) { |
1419 | |||
1420 | if (rev > 1) { | ||
1421 | d->name = "HPT371N"; | 1419 | d->name = "HPT371N"; |
1422 | 1420 | ||
1423 | info = &hpt371n; | 1421 | info = &hpt371n; |
@@ -1442,11 +1440,8 @@ static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) | |||
1442 | static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d) | 1440 | static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d) |
1443 | { | 1441 | { |
1444 | struct hpt_info *info; | 1442 | struct hpt_info *info; |
1445 | u8 rev = 0; | ||
1446 | |||
1447 | pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | ||
1448 | 1443 | ||
1449 | if (rev > 1) { | 1444 | if (dev->revision > 1) { |
1450 | d->name = "HPT372N"; | 1445 | d->name = "HPT372N"; |
1451 | 1446 | ||
1452 | info = &hpt372n; | 1447 | info = &hpt372n; |
@@ -1460,11 +1455,8 @@ static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d | |||
1460 | static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d) | 1455 | static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d) |
1461 | { | 1456 | { |
1462 | struct hpt_info *info; | 1457 | struct hpt_info *info; |
1463 | u8 rev = 0; | ||
1464 | 1458 | ||
1465 | pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | 1459 | if (dev->revision > 1) { |
1466 | |||
1467 | if (rev > 1) { | ||
1468 | d->name = "HPT302N"; | 1460 | d->name = "HPT302N"; |
1469 | 1461 | ||
1470 | info = &hpt302n; | 1462 | info = &hpt302n; |
@@ -1478,7 +1470,7 @@ static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d) | |||
1478 | static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) | 1470 | static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) |
1479 | { | 1471 | { |
1480 | struct pci_dev *dev2; | 1472 | struct pci_dev *dev2; |
1481 | u8 rev = 0; | 1473 | u8 rev = dev->revision; |
1482 | static char *chipset_names[] = { "HPT366", "HPT366", "HPT368", | 1474 | static char *chipset_names[] = { "HPT366", "HPT366", "HPT368", |
1483 | "HPT370", "HPT370A", "HPT372", | 1475 | "HPT370", "HPT370A", "HPT372", |
1484 | "HPT372N" }; | 1476 | "HPT372N" }; |
@@ -1489,8 +1481,6 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) | |||
1489 | if (PCI_FUNC(dev->devfn) & 1) | 1481 | if (PCI_FUNC(dev->devfn) & 1) |
1490 | return -ENODEV; | 1482 | return -ENODEV; |
1491 | 1483 | ||
1492 | pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | ||
1493 | |||
1494 | switch (rev) { | 1484 | switch (rev) { |
1495 | case 0: | 1485 | case 0: |
1496 | case 1: | 1486 | case 1: |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 2e0b29ef596a..1372c35be035 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -572,18 +572,16 @@ static void __devinit piix_check_450nx(void) | |||
572 | { | 572 | { |
573 | struct pci_dev *pdev = NULL; | 573 | struct pci_dev *pdev = NULL; |
574 | u16 cfg; | 574 | u16 cfg; |
575 | u8 rev; | ||
576 | while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL) | 575 | while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL) |
577 | { | 576 | { |
578 | /* Look for 450NX PXB. Check for problem configurations | 577 | /* Look for 450NX PXB. Check for problem configurations |
579 | A PCI quirk checks bit 6 already */ | 578 | A PCI quirk checks bit 6 already */ |
580 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); | ||
581 | pci_read_config_word(pdev, 0x41, &cfg); | 579 | pci_read_config_word(pdev, 0x41, &cfg); |
582 | /* Only on the original revision: IDE DMA can hang */ | 580 | /* Only on the original revision: IDE DMA can hang */ |
583 | if(rev == 0x00) | 581 | if (pdev->revision == 0x00) |
584 | no_piix_dma = 1; | 582 | no_piix_dma = 1; |
585 | /* On all revisions below 5 PXB bus lock must be disabled for IDE */ | 583 | /* On all revisions below 5 PXB bus lock must be disabled for IDE */ |
586 | else if(cfg & (1<<14) && rev < 5) | 584 | else if (cfg & (1<<14) && pdev->revision < 5) |
587 | no_piix_dma = 2; | 585 | no_piix_dma = 2; |
588 | } | 586 | } |
589 | if(no_piix_dma) | 587 | if(no_piix_dma) |
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 1371b5bf6bf0..ed04e0c8dd4c 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -55,7 +55,6 @@ static const char *svwks_bad_ata100[] = { | |||
55 | NULL | 55 | NULL |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static u8 svwks_revision = 0; | ||
59 | static struct pci_dev *isa_dev; | 58 | static struct pci_dev *isa_dev; |
60 | 59 | ||
61 | static int check_in_drive_lists (ide_drive_t *drive, const char **list) | 60 | static int check_in_drive_lists (ide_drive_t *drive, const char **list) |
@@ -71,9 +70,6 @@ static u8 svwks_udma_filter(ide_drive_t *drive) | |||
71 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 70 | struct pci_dev *dev = HWIF(drive)->pci_dev; |
72 | u8 mask = 0; | 71 | u8 mask = 0; |
73 | 72 | ||
74 | if (!svwks_revision) | ||
75 | pci_read_config_byte(dev, PCI_REVISION_ID, &svwks_revision); | ||
76 | |||
77 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) | 73 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) |
78 | return 0x1f; | 74 | return 0x1f; |
79 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { | 75 | if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { |
@@ -88,9 +84,9 @@ static u8 svwks_udma_filter(ide_drive_t *drive) | |||
88 | return 0; | 84 | return 0; |
89 | /* Check the OSB4 DMA33 enable bit */ | 85 | /* Check the OSB4 DMA33 enable bit */ |
90 | return ((reg & 0x00004000) == 0x00004000) ? 0x07 : 0; | 86 | return ((reg & 0x00004000) == 0x00004000) ? 0x07 : 0; |
91 | } else if (svwks_revision < SVWKS_CSB5_REVISION_NEW) { | 87 | } else if (dev->revision < SVWKS_CSB5_REVISION_NEW) { |
92 | return 0x07; | 88 | return 0x07; |
93 | } else if (svwks_revision >= SVWKS_CSB5_REVISION_NEW) { | 89 | } else if (dev->revision >= SVWKS_CSB5_REVISION_NEW) { |
94 | u8 btr = 0, mode; | 90 | u8 btr = 0, mode; |
95 | pci_read_config_byte(dev, 0x5A, &btr); | 91 | pci_read_config_byte(dev, 0x5A, &btr); |
96 | mode = btr & 0x3; | 92 | mode = btr & 0x3; |
@@ -234,9 +230,6 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha | |||
234 | unsigned int reg; | 230 | unsigned int reg; |
235 | u8 btr; | 231 | u8 btr; |
236 | 232 | ||
237 | /* save revision id to determine DMA capability */ | ||
238 | pci_read_config_byte(dev, PCI_REVISION_ID, &svwks_revision); | ||
239 | |||
240 | /* force Master Latency Timer value to 64 PCICLKs */ | 233 | /* force Master Latency Timer value to 64 PCICLKs */ |
241 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x40); | 234 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x40); |
242 | 235 | ||
@@ -315,7 +308,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha | |||
315 | if (!(PCI_FUNC(dev->devfn) & 1)) | 308 | if (!(PCI_FUNC(dev->devfn) & 1)) |
316 | btr |= 0x2; | 309 | btr |= 0x2; |
317 | else | 310 | else |
318 | btr |= (svwks_revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2; | 311 | btr |= (dev->revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2; |
319 | pci_write_config_byte(dev, 0x5A, btr); | 312 | pci_write_config_byte(dev, 0x5A, btr); |
320 | } | 313 | } |
321 | /* Setup HT1000 SouthBridge Controller - Single Channel Only */ | 314 | /* Setup HT1000 SouthBridge Controller - Single Channel Only */ |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index f875183ac8d9..756a9b6eb462 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -659,9 +659,7 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c | |||
659 | 659 | ||
660 | /* Special case for SiS630 : 630S/ET is ATA_100a */ | 660 | /* Special case for SiS630 : 630S/ET is ATA_100a */ |
661 | if (SiSHostChipInfo[i].host_id == PCI_DEVICE_ID_SI_630) { | 661 | if (SiSHostChipInfo[i].host_id == PCI_DEVICE_ID_SI_630) { |
662 | u8 hostrev; | 662 | if (host->revision >= 0x30) |
663 | pci_read_config_byte(host, PCI_REVISION_ID, &hostrev); | ||
664 | if (hostrev >= 0x30) | ||
665 | chipset_family = ATA_100a; | 663 | chipset_family = ATA_100a; |
666 | } | 664 | } |
667 | pci_dev_put(host); | 665 | pci_dev_put(host); |
@@ -702,7 +700,6 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c | |||
702 | u16 trueid; | 700 | u16 trueid; |
703 | u8 prefctl; | 701 | u8 prefctl; |
704 | u8 idecfg; | 702 | u8 idecfg; |
705 | u8 sbrev; | ||
706 | 703 | ||
707 | pci_read_config_byte(dev, 0x4a, &idecfg); | 704 | pci_read_config_byte(dev, 0x4a, &idecfg); |
708 | pci_write_config_byte(dev, 0x4a, idecfg | 0x10); | 705 | pci_write_config_byte(dev, 0x4a, idecfg | 0x10); |
@@ -712,11 +709,10 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c | |||
712 | if (trueid == 0x5517) { /* SiS 961/961B */ | 709 | if (trueid == 0x5517) { /* SiS 961/961B */ |
713 | 710 | ||
714 | lpc_bridge = pci_get_slot(dev->bus, 0x10); /* Bus 0, Dev 2, Fn 0 */ | 711 | lpc_bridge = pci_get_slot(dev->bus, 0x10); /* Bus 0, Dev 2, Fn 0 */ |
715 | pci_read_config_byte(lpc_bridge, PCI_REVISION_ID, &sbrev); | ||
716 | pci_read_config_byte(dev, 0x49, &prefctl); | 712 | pci_read_config_byte(dev, 0x49, &prefctl); |
717 | pci_dev_put(lpc_bridge); | 713 | pci_dev_put(lpc_bridge); |
718 | 714 | ||
719 | if (sbrev == 0x10 && (prefctl & 0x80)) { | 715 | if (lpc_bridge->revision == 0x10 && (prefctl & 0x80)) { |
720 | printk(KERN_INFO "SIS5513: SiS 961B MuTIOL IDE UDMA133 controller\n"); | 716 | printk(KERN_INFO "SIS5513: SiS 961B MuTIOL IDE UDMA133 controller\n"); |
721 | chipset_family = ATA_133a; | 717 | chipset_family = ATA_133a; |
722 | } else { | 718 | } else { |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 487879842af4..a7323d278c49 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -338,7 +338,6 @@ static void sl82c105_tune_drive(ide_drive_t *drive, u8 pio) | |||
338 | static unsigned int sl82c105_bridge_revision(struct pci_dev *dev) | 338 | static unsigned int sl82c105_bridge_revision(struct pci_dev *dev) |
339 | { | 339 | { |
340 | struct pci_dev *bridge; | 340 | struct pci_dev *bridge; |
341 | u8 rev; | ||
342 | 341 | ||
343 | /* | 342 | /* |
344 | * The bridge should be part of the same device, but function 0. | 343 | * The bridge should be part of the same device, but function 0. |
@@ -360,10 +359,9 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev) | |||
360 | /* | 359 | /* |
361 | * We need to find function 0's revision, not function 1 | 360 | * We need to find function 0's revision, not function 1 |
362 | */ | 361 | */ |
363 | pci_read_config_byte(bridge, PCI_REVISION_ID, &rev); | ||
364 | pci_dev_put(bridge); | 362 | pci_dev_put(bridge); |
365 | 363 | ||
366 | return rev; | 364 | return bridge->revision; |
367 | } | 365 | } |
368 | 366 | ||
369 | /* | 367 | /* |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index d21dd2e7eeb3..27e92fb9f95e 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -237,16 +237,14 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) | |||
237 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) | 237 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) |
238 | { | 238 | { |
239 | struct via_isa_bridge *via_config; | 239 | struct via_isa_bridge *via_config; |
240 | u8 t; | ||
241 | 240 | ||
242 | for (via_config = via_isa_bridges; via_config->id; via_config++) | 241 | for (via_config = via_isa_bridges; via_config->id; via_config++) |
243 | if ((*isa = pci_get_device(PCI_VENDOR_ID_VIA + | 242 | if ((*isa = pci_get_device(PCI_VENDOR_ID_VIA + |
244 | !!(via_config->flags & VIA_BAD_ID), | 243 | !!(via_config->flags & VIA_BAD_ID), |
245 | via_config->id, NULL))) { | 244 | via_config->id, NULL))) { |
246 | 245 | ||
247 | pci_read_config_byte(*isa, PCI_REVISION_ID, &t); | 246 | if ((*isa)->revision >= via_config->rev_min && |
248 | if (t >= via_config->rev_min && | 247 | (*isa)->revision <= via_config->rev_max) |
249 | t <= via_config->rev_max) | ||
250 | break; | 248 | break; |
251 | pci_dev_put(*isa); | 249 | pci_dev_put(*isa); |
252 | } | 250 | } |
@@ -404,10 +402,9 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const | |||
404 | * Print the boot message. | 402 | * Print the boot message. |
405 | */ | 403 | */ |
406 | 404 | ||
407 | pci_read_config_byte(isa, PCI_REVISION_ID, &t); | ||
408 | printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s " | 405 | printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s " |
409 | "controller on pci%s\n", | 406 | "controller on pci%s\n", |
410 | via_config->name, t, | 407 | via_config->name, isa->revision, |
411 | via_config->udma_mask ? "U" : "MW", | 408 | via_config->udma_mask ? "U" : "MW", |
412 | via_dma[via_config->udma_mask ? | 409 | via_dma[via_config->udma_mask ? |
413 | (fls(via_config->udma_mask) - 1) : 0], | 410 | (fls(via_config->udma_mask) - 1) : 0], |