aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cmd64x.c
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 /drivers/ide/pci/cmd64x.c
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 'drivers/ide/pci/cmd64x.c')
-rw-r--r--drivers/ide/pci/cmd64x.c9
1 files changed, 2 insertions, 7 deletions
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, &reg7b); 102 (void) pci_read_config_byte(dev, UDIDETCR1, &reg7b);
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
605static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d) 603static 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);