Commit a07f3537 authored by Alan Cox's avatar Alan Cox Committed by James Bottomley

[SCSI] Switch some more scsi drivers to pci_get_device and refcounted pci structures

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 1a68d41a
...@@ -662,7 +662,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd ...@@ -662,7 +662,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
particular standard ISA I/O Address need not be probed. particular standard ISA I/O Address need not be probed.
*/ */
PrimaryProbeInfo->IO_Address = 0; PrimaryProbeInfo->IO_Address = 0;
while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) { while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) {
struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter;
struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation;
enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest; enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest;
...@@ -762,7 +762,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd ...@@ -762,7 +762,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
PrimaryProbeInfo->Bus = Bus; PrimaryProbeInfo->Bus = Bus;
PrimaryProbeInfo->Device = Device; PrimaryProbeInfo->Device = Device;
PrimaryProbeInfo->IRQ_Channel = IRQ_Channel; PrimaryProbeInfo->IRQ_Channel = IRQ_Channel;
PrimaryProbeInfo->PCI_Device = PCI_Device; PrimaryProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
PCIMultiMasterCount++; PCIMultiMasterCount++;
} else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) {
struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++];
...@@ -773,7 +773,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd ...@@ -773,7 +773,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
ProbeInfo->Bus = Bus; ProbeInfo->Bus = Bus;
ProbeInfo->Device = Device; ProbeInfo->Device = Device;
ProbeInfo->IRQ_Channel = IRQ_Channel; ProbeInfo->IRQ_Channel = IRQ_Channel;
ProbeInfo->PCI_Device = PCI_Device; ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
NonPrimaryPCIMultiMasterCount++; NonPrimaryPCIMultiMasterCount++;
PCIMultiMasterCount++; PCIMultiMasterCount++;
} else } else
...@@ -823,7 +823,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd ...@@ -823,7 +823,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
noting the PCI bus location and assigned IRQ Channel. noting the PCI bus location and assigned IRQ Channel.
*/ */
PCI_Device = NULL; PCI_Device = NULL;
while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) { while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) {
unsigned char Bus; unsigned char Bus;
unsigned char Device; unsigned char Device;
unsigned int IRQ_Channel; unsigned int IRQ_Channel;
...@@ -850,7 +850,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd ...@@ -850,7 +850,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
ProbeInfo->Bus = Bus; ProbeInfo->Bus = Bus;
ProbeInfo->Device = Device; ProbeInfo->Device = Device;
ProbeInfo->IRQ_Channel = IRQ_Channel; ProbeInfo->IRQ_Channel = IRQ_Channel;
ProbeInfo->PCI_Device = PCI_Device; ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
break; break;
} }
} }
...@@ -874,7 +874,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda ...@@ -874,7 +874,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
/* /*
Interrogate PCI Configuration Space for any FlashPoint Host Adapters. Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
*/ */
while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) { while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) {
unsigned char Bus; unsigned char Bus;
unsigned char Device; unsigned char Device;
unsigned int IRQ_Channel; unsigned int IRQ_Channel;
...@@ -923,7 +923,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda ...@@ -923,7 +923,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
ProbeInfo->Bus = Bus; ProbeInfo->Bus = Bus;
ProbeInfo->Device = Device; ProbeInfo->Device = Device;
ProbeInfo->IRQ_Channel = IRQ_Channel; ProbeInfo->IRQ_Channel = IRQ_Channel;
ProbeInfo->PCI_Device = PCI_Device; ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
FlashPointCount++; FlashPointCount++;
} else } else
BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL);
...@@ -1890,6 +1890,7 @@ static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter) ...@@ -1890,6 +1890,7 @@ static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter)
*/ */
if (HostAdapter->MailboxSpace) if (HostAdapter->MailboxSpace)
pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle); pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle);
pci_dev_put(HostAdapter->PCI_Device);
HostAdapter->MailboxSpace = NULL; HostAdapter->MailboxSpace = NULL;
HostAdapter->MailboxSpaceHandle = 0; HostAdapter->MailboxSpaceHandle = 0;
HostAdapter->MailboxSize = 0; HostAdapter->MailboxSize = 0;
......
...@@ -9194,7 +9194,7 @@ aic7xxx_detect(struct scsi_host_template *template) ...@@ -9194,7 +9194,7 @@ aic7xxx_detect(struct scsi_host_template *template)
for (i = 0; i < ARRAY_SIZE(aic_pdevs); i++) for (i = 0; i < ARRAY_SIZE(aic_pdevs); i++)
{ {
pdev = NULL; pdev = NULL;
while ((pdev = pci_find_device(aic_pdevs[i].vendor_id, while ((pdev = pci_get_device(aic_pdevs[i].vendor_id,
aic_pdevs[i].device_id, aic_pdevs[i].device_id,
pdev))) { pdev))) {
if (pci_enable_device(pdev)) if (pci_enable_device(pdev))
...@@ -9651,6 +9651,9 @@ aic7xxx_detect(struct scsi_host_template *template) ...@@ -9651,6 +9651,9 @@ aic7xxx_detect(struct scsi_host_template *template)
*/ */
aic7xxx_configure_bugs(temp_p); aic7xxx_configure_bugs(temp_p);
/* Hold a pci device reference */
pci_dev_get(temp_p->pdev);
if ( list_p == NULL ) if ( list_p == NULL )
{ {
list_p = current_p = temp_p; list_p = current_p = temp_p;
...@@ -10987,8 +10990,10 @@ aic7xxx_release(struct Scsi_Host *host) ...@@ -10987,8 +10990,10 @@ aic7xxx_release(struct Scsi_Host *host)
if(!p->pdev) if(!p->pdev)
release_region(p->base, MAXREG - MINREG); release_region(p->base, MAXREG - MINREG);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
else else {
pci_release_regions(p->pdev); pci_release_regions(p->pdev);
pci_dev_put(p->pdev);
}
#endif #endif
prev = NULL; prev = NULL;
next = first_aic7xxx; next = first_aic7xxx;
......
...@@ -184,7 +184,7 @@ static int adpt_detect(struct scsi_host_template* sht) ...@@ -184,7 +184,7 @@ static int adpt_detect(struct scsi_host_template* sht)
PINFO("Detecting Adaptec I2O RAID controllers...\n"); PINFO("Detecting Adaptec I2O RAID controllers...\n");
/* search for all Adatpec I2O RAID cards */ /* search for all Adatpec I2O RAID cards */
while ((pDev = pci_find_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
if(pDev->device == PCI_DPT_DEVICE_ID || if(pDev->device == PCI_DPT_DEVICE_ID ||
pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
if(adpt_install_hba(sht, pDev) ){ if(adpt_install_hba(sht, pDev) ){
...@@ -192,8 +192,11 @@ static int adpt_detect(struct scsi_host_template* sht) ...@@ -192,8 +192,11 @@ static int adpt_detect(struct scsi_host_template* sht)
PERROR("Will not try to detect others.\n"); PERROR("Will not try to detect others.\n");
return hba_count-1; return hba_count-1;
} }
pci_dev_get(pDev);
} }
} }
if (pDev)
pci_dev_put(pDev);
/* In INIT state, Activate IOPs */ /* In INIT state, Activate IOPs */
for (pHba = hba_chain; pHba; pHba = pHba->next) { for (pHba = hba_chain; pHba; pHba = pHba->next) {
...@@ -1075,6 +1078,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) ...@@ -1075,6 +1078,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
} }
} }
} }
pci_dev_put(pHba->pDev);
kfree(pHba); kfree(pHba);
if(hba_count <= 0){ if(hba_count <= 0){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment