aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-09-15 10:34:32 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-09-23 21:32:52 -0400
commita07f353701acae77e023f6270e8af353b37af7c4 (patch)
tree150bb61c6eb1891afaaa79047a399e3e66f561a2 /drivers
parent1a68d41a334a406d4bd35999f0be4d47f193e477 (diff)
[SCSI] Switch some more scsi drivers to pci_get_device and refcounted pci structures
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/BusLogic.c15
-rw-r--r--drivers/scsi/aic7xxx_old.c9
-rw-r--r--drivers/scsi/dpt_i2o.c6
3 files changed, 20 insertions, 10 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 59d1adaed73e..4ea49fd7965e 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -662,7 +662,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
662 particular standard ISA I/O Address need not be probed. 662 particular standard ISA I/O Address need not be probed.
663 */ 663 */
664 PrimaryProbeInfo->IO_Address = 0; 664 PrimaryProbeInfo->IO_Address = 0;
665 while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) { 665 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_Device)) != NULL) {
666 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter; 666 struct BusLogic_HostAdapter *HostAdapter = PrototypeHostAdapter;
667 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation; 667 struct BusLogic_PCIHostAdapterInformation PCIHostAdapterInformation;
668 enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest; 668 enum BusLogic_ISACompatibleIOPort ModifyIOAddressRequest;
@@ -762,7 +762,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
762 PrimaryProbeInfo->Bus = Bus; 762 PrimaryProbeInfo->Bus = Bus;
763 PrimaryProbeInfo->Device = Device; 763 PrimaryProbeInfo->Device = Device;
764 PrimaryProbeInfo->IRQ_Channel = IRQ_Channel; 764 PrimaryProbeInfo->IRQ_Channel = IRQ_Channel;
765 PrimaryProbeInfo->PCI_Device = PCI_Device; 765 PrimaryProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
766 PCIMultiMasterCount++; 766 PCIMultiMasterCount++;
767 } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) { 767 } else if (BusLogic_ProbeInfoCount < BusLogic_MaxHostAdapters) {
768 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++]; 768 struct BusLogic_ProbeInfo *ProbeInfo = &BusLogic_ProbeInfoList[BusLogic_ProbeInfoCount++];
@@ -773,7 +773,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
773 ProbeInfo->Bus = Bus; 773 ProbeInfo->Bus = Bus;
774 ProbeInfo->Device = Device; 774 ProbeInfo->Device = Device;
775 ProbeInfo->IRQ_Channel = IRQ_Channel; 775 ProbeInfo->IRQ_Channel = IRQ_Channel;
776 ProbeInfo->PCI_Device = PCI_Device; 776 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
777 NonPrimaryPCIMultiMasterCount++; 777 NonPrimaryPCIMultiMasterCount++;
778 PCIMultiMasterCount++; 778 PCIMultiMasterCount++;
779 } else 779 } else
@@ -823,7 +823,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
823 noting the PCI bus location and assigned IRQ Channel. 823 noting the PCI bus location and assigned IRQ Channel.
824 */ 824 */
825 PCI_Device = NULL; 825 PCI_Device = NULL;
826 while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) { 826 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, PCI_Device)) != NULL) {
827 unsigned char Bus; 827 unsigned char Bus;
828 unsigned char Device; 828 unsigned char Device;
829 unsigned int IRQ_Channel; 829 unsigned int IRQ_Channel;
@@ -850,7 +850,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
850 ProbeInfo->Bus = Bus; 850 ProbeInfo->Bus = Bus;
851 ProbeInfo->Device = Device; 851 ProbeInfo->Device = Device;
852 ProbeInfo->IRQ_Channel = IRQ_Channel; 852 ProbeInfo->IRQ_Channel = IRQ_Channel;
853 ProbeInfo->PCI_Device = PCI_Device; 853 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
854 break; 854 break;
855 } 855 }
856 } 856 }
@@ -874,7 +874,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
874 /* 874 /*
875 Interrogate PCI Configuration Space for any FlashPoint Host Adapters. 875 Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
876 */ 876 */
877 while ((PCI_Device = pci_find_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) { 877 while ((PCI_Device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, PCI_Device)) != NULL) {
878 unsigned char Bus; 878 unsigned char Bus;
879 unsigned char Device; 879 unsigned char Device;
880 unsigned int IRQ_Channel; 880 unsigned int IRQ_Channel;
@@ -923,7 +923,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
923 ProbeInfo->Bus = Bus; 923 ProbeInfo->Bus = Bus;
924 ProbeInfo->Device = Device; 924 ProbeInfo->Device = Device;
925 ProbeInfo->IRQ_Channel = IRQ_Channel; 925 ProbeInfo->IRQ_Channel = IRQ_Channel;
926 ProbeInfo->PCI_Device = PCI_Device; 926 ProbeInfo->PCI_Device = pci_dev_get(PCI_Device);
927 FlashPointCount++; 927 FlashPointCount++;
928 } else 928 } else
929 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL); 929 BusLogic_Warning("BusLogic: Too many Host Adapters " "detected\n", NULL);
@@ -1890,6 +1890,7 @@ static void BusLogic_ReleaseResources(struct BusLogic_HostAdapter *HostAdapter)
1890 */ 1890 */
1891 if (HostAdapter->MailboxSpace) 1891 if (HostAdapter->MailboxSpace)
1892 pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle); 1892 pci_free_consistent(HostAdapter->PCI_Device, HostAdapter->MailboxSize, HostAdapter->MailboxSpace, HostAdapter->MailboxSpaceHandle);
1893 pci_dev_put(HostAdapter->PCI_Device);
1893 HostAdapter->MailboxSpace = NULL; 1894 HostAdapter->MailboxSpace = NULL;
1894 HostAdapter->MailboxSpaceHandle = 0; 1895 HostAdapter->MailboxSpaceHandle = 0;
1895 HostAdapter->MailboxSize = 0; 1896 HostAdapter->MailboxSize = 0;
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index ba3bccafe113..5dcef48d414f 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -9194,7 +9194,7 @@ aic7xxx_detect(struct scsi_host_template *template)
9194 for (i = 0; i < ARRAY_SIZE(aic_pdevs); i++) 9194 for (i = 0; i < ARRAY_SIZE(aic_pdevs); i++)
9195 { 9195 {
9196 pdev = NULL; 9196 pdev = NULL;
9197 while ((pdev = pci_find_device(aic_pdevs[i].vendor_id, 9197 while ((pdev = pci_get_device(aic_pdevs[i].vendor_id,
9198 aic_pdevs[i].device_id, 9198 aic_pdevs[i].device_id,
9199 pdev))) { 9199 pdev))) {
9200 if (pci_enable_device(pdev)) 9200 if (pci_enable_device(pdev))
@@ -9651,6 +9651,9 @@ aic7xxx_detect(struct scsi_host_template *template)
9651 */ 9651 */
9652 aic7xxx_configure_bugs(temp_p); 9652 aic7xxx_configure_bugs(temp_p);
9653 9653
9654 /* Hold a pci device reference */
9655 pci_dev_get(temp_p->pdev);
9656
9654 if ( list_p == NULL ) 9657 if ( list_p == NULL )
9655 { 9658 {
9656 list_p = current_p = temp_p; 9659 list_p = current_p = temp_p;
@@ -10987,8 +10990,10 @@ aic7xxx_release(struct Scsi_Host *host)
10987 if(!p->pdev) 10990 if(!p->pdev)
10988 release_region(p->base, MAXREG - MINREG); 10991 release_region(p->base, MAXREG - MINREG);
10989#ifdef CONFIG_PCI 10992#ifdef CONFIG_PCI
10990 else 10993 else {
10991 pci_release_regions(p->pdev); 10994 pci_release_regions(p->pdev);
10995 pci_dev_put(p->pdev);
10996 }
10992#endif 10997#endif
10993 prev = NULL; 10998 prev = NULL;
10994 next = first_aic7xxx; 10999 next = first_aic7xxx;
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 45806336ce02..7b3bd34faf47 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -184,7 +184,7 @@ static int adpt_detect(struct scsi_host_template* sht)
184 PINFO("Detecting Adaptec I2O RAID controllers...\n"); 184 PINFO("Detecting Adaptec I2O RAID controllers...\n");
185 185
186 /* search for all Adatpec I2O RAID cards */ 186 /* search for all Adatpec I2O RAID cards */
187 while ((pDev = pci_find_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) { 187 while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
188 if(pDev->device == PCI_DPT_DEVICE_ID || 188 if(pDev->device == PCI_DPT_DEVICE_ID ||
189 pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){ 189 pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
190 if(adpt_install_hba(sht, pDev) ){ 190 if(adpt_install_hba(sht, pDev) ){
@@ -192,8 +192,11 @@ static int adpt_detect(struct scsi_host_template* sht)
192 PERROR("Will not try to detect others.\n"); 192 PERROR("Will not try to detect others.\n");
193 return hba_count-1; 193 return hba_count-1;
194 } 194 }
195 pci_dev_get(pDev);
195 } 196 }
196 } 197 }
198 if (pDev)
199 pci_dev_put(pDev);
197 200
198 /* In INIT state, Activate IOPs */ 201 /* In INIT state, Activate IOPs */
199 for (pHba = hba_chain; pHba; pHba = pHba->next) { 202 for (pHba = hba_chain; pHba; pHba = pHba->next) {
@@ -1075,6 +1078,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1075 } 1078 }
1076 } 1079 }
1077 } 1080 }
1081 pci_dev_put(pHba->pDev);
1078 kfree(pHba); 1082 kfree(pHba);
1079 1083
1080 if(hba_count <= 0){ 1084 if(hba_count <= 0){