aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2008-02-15 21:35:26 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:15:36 -0400
commit4c9c8d782c8dddc5e97d33210e8a993cec6bc168 (patch)
tree6b8c8d5848da51f9f7d16fba7f61098c20088cc0 /drivers/scsi
parent4cac04dd63fa3b202ee313ed1afbbd135ab887ee (diff)
[SCSI] gdth: PCI probe cleanups, prep for PCI hotplug API conversion
- Reduce uses of gdth_pci_str::pdev, preferring a local variable (or function arg) 'pdev' instead. - Reduce uses of gdth_pcistr array, preferring local variable (or function arg) 'pcistr' instead. - Eliminate lone use of gdth_pci_str::irq, using equivalent pdev->irq instead - Eliminate assign-only gdth_pci_str::io_mm Note: If the indentation seems weird, that's because a line was converted from spaces to tabs, when it was modified. Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/gdth.c59
-rw-r--r--drivers/scsi/gdth.h2
2 files changed, 28 insertions, 33 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 0b2080d33575..12be6729898a 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -649,7 +649,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
649 649
650 /* GDT PCI controller found, resources are already in pdev */ 650 /* GDT PCI controller found, resources are already in pdev */
651 pcistr[*cnt].pdev = pdev; 651 pcistr[*cnt].pdev = pdev;
652 pcistr[*cnt].irq = pdev->irq;
653 base0 = pci_resource_flags(pdev, 0); 652 base0 = pci_resource_flags(pdev, 0);
654 base1 = pci_resource_flags(pdev, 1); 653 base1 = pci_resource_flags(pdev, 1);
655 base2 = pci_resource_flags(pdev, 2); 654 base2 = pci_resource_flags(pdev, 2);
@@ -664,7 +663,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
664 !(base1 & IORESOURCE_IO)) 663 !(base1 & IORESOURCE_IO))
665 continue; 664 continue;
666 pcistr[*cnt].dpmem = pci_resource_start(pdev, 2); 665 pcistr[*cnt].dpmem = pci_resource_start(pdev, 2);
667 pcistr[*cnt].io_mm = pci_resource_start(pdev, 0);
668 pcistr[*cnt].io = pci_resource_start(pdev, 1); 666 pcistr[*cnt].io = pci_resource_start(pdev, 1);
669 } 667 }
670 TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", 668 TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n",
@@ -909,7 +907,8 @@ static int __init gdth_init_isa(ulong32 bios_adr,gdth_ha_str *ha)
909#endif /* CONFIG_ISA */ 907#endif /* CONFIG_ISA */
910 908
911#ifdef CONFIG_PCI 909#ifdef CONFIG_PCI
912static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) 910static int __init gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
911 gdth_ha_str *ha)
913{ 912{
914 register gdt6_dpram_str __iomem *dp6_ptr; 913 register gdt6_dpram_str __iomem *dp6_ptr;
915 register gdt6c_dpram_str __iomem *dp6c_ptr; 914 register gdt6c_dpram_str __iomem *dp6c_ptr;
@@ -921,14 +920,14 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
921 920
922 TRACE(("gdth_init_pci()\n")); 921 TRACE(("gdth_init_pci()\n"));
923 922
924 if (pcistr->pdev->vendor == PCI_VENDOR_ID_INTEL) 923 if (pdev->vendor == PCI_VENDOR_ID_INTEL)
925 ha->oem_id = OEM_ID_INTEL; 924 ha->oem_id = OEM_ID_INTEL;
926 else 925 else
927 ha->oem_id = OEM_ID_ICP; 926 ha->oem_id = OEM_ID_ICP;
928 ha->brd_phys = (pcistr->pdev->bus->number << 8) | (pcistr->pdev->devfn & 0xf8); 927 ha->brd_phys = (pdev->bus->number << 8) | (pdev->devfn & 0xf8);
929 ha->stype = (ulong32)pcistr->pdev->device; 928 ha->stype = (ulong32)pdev->device;
930 ha->irq = pcistr->irq; 929 ha->irq = pdev->irq;
931 ha->pdev = pcistr->pdev; 930 ha->pdev = pdev;
932 931
933 if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ 932 if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */
934 TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); 933 TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq));
@@ -956,8 +955,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
956 continue; 955 continue;
957 } 956 }
958 iounmap(ha->brd); 957 iounmap(ha->brd);
959 pci_write_config_dword(pcistr->pdev, 958 pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, i);
960 PCI_BASE_ADDRESS_0, i);
961 ha->brd = ioremap(i, sizeof(gdt6_dpram_str)); 959 ha->brd = ioremap(i, sizeof(gdt6_dpram_str));
962 if (ha->brd == NULL) { 960 if (ha->brd == NULL) {
963 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); 961 printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
@@ -1066,8 +1064,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
1066 continue; 1064 continue;
1067 } 1065 }
1068 iounmap(ha->brd); 1066 iounmap(ha->brd);
1069 pci_write_config_dword(pcistr->pdev, 1067 pci_write_config_dword(pdev, PCI_BASE_ADDRESS_2, i);
1070 PCI_BASE_ADDRESS_2, i);
1071 ha->brd = ioremap(i, sizeof(gdt6c_dpram_str)); 1068 ha->brd = ioremap(i, sizeof(gdt6c_dpram_str));
1072 if (ha->brd == NULL) { 1069 if (ha->brd == NULL) {
1073 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); 1070 printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
@@ -1159,16 +1156,16 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
1159 } 1156 }
1160 1157
1161 /* manipulate config. space to enable DPMEM, start RP controller */ 1158 /* manipulate config. space to enable DPMEM, start RP controller */
1162 pci_read_config_word(pcistr->pdev, PCI_COMMAND, &command); 1159 pci_read_config_word(pdev, PCI_COMMAND, &command);
1163 command |= 6; 1160 command |= 6;
1164 pci_write_config_word(pcistr->pdev, PCI_COMMAND, command); 1161 pci_write_config_word(pdev, PCI_COMMAND, command);
1165 if (pci_resource_start(pcistr->pdev, 8) == 1UL) 1162 if (pci_resource_start(pdev, 8) == 1UL)
1166 pci_resource_start(pcistr->pdev, 8) = 0UL; 1163 pci_resource_start(pdev, 8) = 0UL;
1167 i = 0xFEFF0001UL; 1164 i = 0xFEFF0001UL;
1168 pci_write_config_dword(pcistr->pdev, PCI_ROM_ADDRESS, i); 1165 pci_write_config_dword(pdev, PCI_ROM_ADDRESS, i);
1169 gdth_delay(1); 1166 gdth_delay(1);
1170 pci_write_config_dword(pcistr->pdev, PCI_ROM_ADDRESS, 1167 pci_write_config_dword(pdev, PCI_ROM_ADDRESS,
1171 pci_resource_start(pcistr->pdev, 8)); 1168 pci_resource_start(pdev, 8));
1172 1169
1173 dp6m_ptr = ha->brd; 1170 dp6m_ptr = ha->brd;
1174 1171
@@ -1195,8 +1192,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
1195 continue; 1192 continue;
1196 } 1193 }
1197 iounmap(ha->brd); 1194 iounmap(ha->brd);
1198 pci_write_config_dword(pcistr->pdev, 1195 pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, i);
1199 PCI_BASE_ADDRESS_0, i);
1200 ha->brd = ioremap(i, sizeof(gdt6m_dpram_str)); 1196 ha->brd = ioremap(i, sizeof(gdt6m_dpram_str));
1201 if (ha->brd == NULL) { 1197 if (ha->brd == NULL) {
1202 printk("GDT-PCI: Initialization error (DPMEM remap error)\n"); 1198 printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
@@ -4955,12 +4951,13 @@ static int __init gdth_eisa_probe_one(ushort eisa_slot)
4955#endif /* CONFIG_EISA */ 4951#endif /* CONFIG_EISA */
4956 4952
4957#ifdef CONFIG_PCI 4953#ifdef CONFIG_PCI
4958static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr) 4954static int __init gdth_pci_probe_one(gdth_pci_str *pcistr)
4959{ 4955{
4960 struct Scsi_Host *shp; 4956 struct Scsi_Host *shp;
4961 gdth_ha_str *ha; 4957 gdth_ha_str *ha;
4962 dma_addr_t scratch_dma_handle = 0; 4958 dma_addr_t scratch_dma_handle = 0;
4963 int error, i; 4959 int error, i;
4960 struct pci_dev *pdev = pcistr->pdev;
4964 4961
4965 shp = scsi_host_alloc(&gdth_template, sizeof(gdth_ha_str)); 4962 shp = scsi_host_alloc(&gdth_template, sizeof(gdth_ha_str));
4966 if (!shp) 4963 if (!shp)
@@ -4968,13 +4965,13 @@ static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr)
4968 ha = shost_priv(shp); 4965 ha = shost_priv(shp);
4969 4966
4970 error = -ENODEV; 4967 error = -ENODEV;
4971 if (!gdth_init_pci(&pcistr[ctr],ha)) 4968 if (!gdth_init_pci(pdev, pcistr, ha))
4972 goto out_host_put; 4969 goto out_host_put;
4973 4970
4974 /* controller found and initialized */ 4971 /* controller found and initialized */
4975 printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", 4972 printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n",
4976 pcistr[ctr].pdev->bus->number, 4973 pdev->bus->number,
4977 PCI_SLOT(pcistr[ctr].pdev->devfn), 4974 PCI_SLOT(pdev->devfn),
4978 ha->irq); 4975 ha->irq);
4979 4976
4980 error = request_irq(ha->irq, gdth_interrupt, 4977 error = request_irq(ha->irq, gdth_interrupt,
@@ -5019,7 +5016,7 @@ static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr)
5019 5016
5020 ha->scratch_busy = FALSE; 5017 ha->scratch_busy = FALSE;
5021 ha->req_first = NULL; 5018 ha->req_first = NULL;
5022 ha->tid_cnt = pcistr[ctr].pdev->device >= 0x200 ? MAXID : MAX_HDRIVES; 5019 ha->tid_cnt = pdev->device >= 0x200 ? MAXID : MAX_HDRIVES;
5023 if (max_ids > 0 && max_ids < ha->tid_cnt) 5020 if (max_ids > 0 && max_ids < ha->tid_cnt)
5024 ha->tid_cnt = max_ids; 5021 ha->tid_cnt = max_ids;
5025 for (i = 0; i < GDTH_MAXCMDS; ++i) 5022 for (i = 0; i < GDTH_MAXCMDS; ++i)
@@ -5039,16 +5036,16 @@ static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr)
5039 /* 64-bit DMA only supported from FW >= x.43 */ 5036 /* 64-bit DMA only supported from FW >= x.43 */
5040 if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) || 5037 if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) ||
5041 !ha->dma64_support) { 5038 !ha->dma64_support) {
5042 if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) { 5039 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
5043 printk(KERN_WARNING "GDT-PCI %d: " 5040 printk(KERN_WARNING "GDT-PCI %d: "
5044 "Unable to set 32-bit DMA\n", ha->hanum); 5041 "Unable to set 32-bit DMA\n", ha->hanum);
5045 goto out_free_coal_stat; 5042 goto out_free_coal_stat;
5046 } 5043 }
5047 } else { 5044 } else {
5048 shp->max_cmd_len = 16; 5045 shp->max_cmd_len = 16;
5049 if (!pci_set_dma_mask(pcistr[ctr].pdev, DMA_64BIT_MASK)) { 5046 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
5050 printk("GDT-PCI %d: 64-bit DMA enabled\n", ha->hanum); 5047 printk("GDT-PCI %d: 64-bit DMA enabled\n", ha->hanum);
5051 } else if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) { 5048 } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
5052 printk(KERN_WARNING "GDT-PCI %d: " 5049 printk(KERN_WARNING "GDT-PCI %d: "
5053 "Unable to set 64/32-bit DMA\n", ha->hanum); 5050 "Unable to set 64/32-bit DMA\n", ha->hanum);
5054 goto out_free_coal_stat; 5051 goto out_free_coal_stat;
@@ -5062,7 +5059,7 @@ static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr)
5062 spin_lock_init(&ha->smp_lock); 5059 spin_lock_init(&ha->smp_lock);
5063 gdth_enable_int(ha); 5060 gdth_enable_int(ha);
5064 5061
5065 error = scsi_add_host(shp, &pcistr[ctr].pdev->dev); 5062 error = scsi_add_host(shp, &pdev->dev);
5066 if (error) 5063 if (error)
5067 goto out_free_coal_stat; 5064 goto out_free_coal_stat;
5068 list_add_tail(&ha->list, &gdth_instances); 5065 list_add_tail(&ha->list, &gdth_instances);
@@ -5193,7 +5190,7 @@ static int __init gdth_init(void)
5193 printk("GDT-HA: Found %d PCI Storage RAID Controllers\n", cnt); 5190 printk("GDT-HA: Found %d PCI Storage RAID Controllers\n", cnt);
5194 gdth_sort_pci(pcistr,cnt); 5191 gdth_sort_pci(pcistr,cnt);
5195 for (ctr = 0; ctr < cnt; ++ctr) 5192 for (ctr = 0; ctr < cnt; ++ctr)
5196 gdth_pci_probe_one(pcistr, ctr); 5193 gdth_pci_probe_one(&pcistr[ctr]);
5197 } 5194 }
5198#endif /* CONFIG_PCI */ 5195#endif /* CONFIG_PCI */
5199 5196
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h
index 26e4e92515e0..ca92476727cf 100644
--- a/drivers/scsi/gdth.h
+++ b/drivers/scsi/gdth.h
@@ -839,8 +839,6 @@ typedef struct {
839 struct pci_dev *pdev; 839 struct pci_dev *pdev;
840 ulong dpmem; /* DPRAM address */ 840 ulong dpmem; /* DPRAM address */
841 ulong io; /* IO address */ 841 ulong io; /* IO address */
842 ulong io_mm; /* IO address mem. mapped */
843 unchar irq; /* IRQ */
844} gdth_pci_str; 842} gdth_pci_str;
845 843
846 844