aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/hpt366.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/hpt366.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/hpt366.c')
-rw-r--r--drivers/ide/pci/hpt366.c20
1 files changed, 5 insertions, 15 deletions
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
1413static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) 1413static 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)
1442static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d) 1440static 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
1460static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d) 1455static 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)
1478static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) 1470static 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: