aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
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/scsi
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/scsi')
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c9
-rw-r--r--drivers/scsi/ipr.c22
-rw-r--r--drivers/scsi/ips.c9
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
4 files changed, 9 insertions, 33 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 27852b43b904..1c0d7578e791 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -223,13 +223,8 @@ static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha)
223{ 223{
224 int err, i; 224 int err, i;
225 225
226 err = pci_read_config_byte(asd_ha->pcidev, PCI_REVISION_ID, 226 asd_ha->revision_id = asd_ha->pcidev->revision;
227 &asd_ha->revision_id); 227
228 if (err) {
229 asd_printk("couldn't read REVISION ID register of %s\n",
230 pci_name(asd_ha->pcidev));
231 goto Err;
232 }
233 err = -ENODEV; 228 err = -ENODEV;
234 if (asd_ha->revision_id < AIC9410_DEV_REV_B0) { 229 if (asd_ha->revision_id < AIC9410_DEV_REV_B0) {
235 asd_printk("%s is revision %s (%X), which is not supported\n", 230 asd_printk("%s is revision %s (%X), which is not supported\n",
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index fa6ff295e568..81330712048c 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5367,18 +5367,12 @@ static const u16 ipr_blocked_processors[] = {
5367 **/ 5367 **/
5368static int ipr_invalid_adapter(struct ipr_ioa_cfg *ioa_cfg) 5368static int ipr_invalid_adapter(struct ipr_ioa_cfg *ioa_cfg)
5369{ 5369{
5370 u8 rev_id;
5371 int i; 5370 int i;
5372 5371
5373 if (ioa_cfg->type == 0x5702) { 5372 if ((ioa_cfg->type == 0x5702) && (ioa_cfg->pdev->revision < 4)) {
5374 if (pci_read_config_byte(ioa_cfg->pdev, PCI_REVISION_ID, 5373 for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++){
5375 &rev_id) == PCIBIOS_SUCCESSFUL) { 5374 if (__is_processor(ipr_blocked_processors[i]))
5376 if (rev_id < 4) { 5375 return 1;
5377 for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++){
5378 if (__is_processor(ipr_blocked_processors[i]))
5379 return 1;
5380 }
5381 }
5382 } 5376 }
5383 } 5377 }
5384 return 0; 5378 return 0;
@@ -7535,13 +7529,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
7535 else 7529 else
7536 ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT; 7530 ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT;
7537 7531
7538 rc = pci_read_config_byte(pdev, PCI_REVISION_ID, &ioa_cfg->revid); 7532 ioa_cfg->revid = pdev->revision;
7539
7540 if (rc != PCIBIOS_SUCCESSFUL) {
7541 dev_err(&pdev->dev, "Failed to read PCI revision ID\n");
7542 rc = -EIO;
7543 goto out_scsi_host_put;
7544 }
7545 7533
7546 ipr_regs_pci = pci_resource_start(pdev, 0); 7534 ipr_regs_pci = pci_resource_start(pdev, 0);
7547 7535
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 8b704f73055a..40f148e0833f 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -7148,7 +7148,6 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
7148 uint32_t mem_addr; 7148 uint32_t mem_addr;
7149 uint32_t io_len; 7149 uint32_t io_len;
7150 uint32_t mem_len; 7150 uint32_t mem_len;
7151 uint8_t revision_id;
7152 uint8_t bus; 7151 uint8_t bus;
7153 uint8_t func; 7152 uint8_t func;
7154 uint8_t irq; 7153 uint8_t irq;
@@ -7227,12 +7226,6 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
7227 } 7226 }
7228 } 7227 }
7229 7228
7230 /* get the revision ID */
7231 if (pci_read_config_byte(pci_dev, PCI_REVISION_ID, &revision_id)) {
7232 IPS_PRINTK(KERN_WARNING, pci_dev, "Can't get revision id.\n");
7233 return -1;
7234 }
7235
7236 subdevice_id = pci_dev->subsystem_device; 7229 subdevice_id = pci_dev->subsystem_device;
7237 7230
7238 /* found a controller */ 7231 /* found a controller */
@@ -7258,7 +7251,7 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
7258 ha->mem_ptr = mem_ptr; 7251 ha->mem_ptr = mem_ptr;
7259 ha->ioremap_ptr = ioremap_ptr; 7252 ha->ioremap_ptr = ioremap_ptr;
7260 ha->host_num = (uint32_t) index; 7253 ha->host_num = (uint32_t) index;
7261 ha->revision_id = revision_id; 7254 ha->revision_id = pci_dev->revision;
7262 ha->slot_num = PCI_SLOT(pci_dev->devfn); 7255 ha->slot_num = PCI_SLOT(pci_dev->devfn);
7263 ha->device_id = pci_dev->device; 7256 ha->device_id = pci_dev->device;
7264 ha->subdevice_id = subdevice_id; 7257 ha->subdevice_id = subdevice_id;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2a45aec4ff29..cf94f8636ba5 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -296,7 +296,7 @@ qla24xx_pci_config(scsi_qla_host_t *ha)
296 d &= ~PCI_ROM_ADDRESS_ENABLE; 296 d &= ~PCI_ROM_ADDRESS_ENABLE;
297 pci_write_config_dword(ha->pdev, PCI_ROM_ADDRESS, d); 297 pci_write_config_dword(ha->pdev, PCI_ROM_ADDRESS, d);
298 298
299 pci_read_config_word(ha->pdev, PCI_REVISION_ID, &ha->chip_revision); 299 ha->chip_revision = ha->pdev->revision;
300 300
301 /* Get PCI bus information. */ 301 /* Get PCI bus information. */
302 spin_lock_irqsave(&ha->hardware_lock, flags); 302 spin_lock_irqsave(&ha->hardware_lock, flags);