diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-07-17 05:25:17 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-07-31 11:36:30 -0400 |
commit | 8e9a8a0d56c5d9d87adbefbbc8c8728c529fd95a (patch) | |
tree | 74b07260b2ed5cb1fe8e1ebe2b9030eecc485f8b | |
parent | 7603e02eac309626c0153ebddf277253ea7fe0e0 (diff) |
[SCSI] gdth: remove redundant PCI stuff
This patch
* removes struct members that duplicate pci_dev members
* replaces ha->stype usage with ha->pdev->device usage where feasible
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Achim Leubner <Achim_Leubner@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/gdth.c | 48 | ||||
-rw-r--r-- | drivers/scsi/gdth.h | 6 |
2 files changed, 22 insertions, 32 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index d0b95ce0ba00..55e4d2dc2bbe 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -902,11 +902,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, | |||
902 | return; | 902 | return; |
903 | /* GDT PCI controller found, resources are already in pdev */ | 903 | /* GDT PCI controller found, resources are already in pdev */ |
904 | pcistr[*cnt].pdev = pdev; | 904 | pcistr[*cnt].pdev = pdev; |
905 | pcistr[*cnt].vendor_id = vendor; | ||
906 | pcistr[*cnt].device_id = device; | ||
907 | pcistr[*cnt].subdevice_id = pdev->subsystem_device; | ||
908 | pcistr[*cnt].bus = pdev->bus->number; | ||
909 | pcistr[*cnt].device_fn = pdev->devfn; | ||
910 | pcistr[*cnt].irq = pdev->irq; | 905 | pcistr[*cnt].irq = pdev->irq; |
911 | base0 = pci_resource_flags(pdev, 0); | 906 | base0 = pci_resource_flags(pdev, 0); |
912 | base1 = pci_resource_flags(pdev, 1); | 907 | base1 = pci_resource_flags(pdev, 1); |
@@ -926,7 +921,8 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, | |||
926 | pcistr[*cnt].io = pci_resource_start(pdev, 1); | 921 | pcistr[*cnt].io = pci_resource_start(pdev, 1); |
927 | } | 922 | } |
928 | TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", | 923 | TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", |
929 | pcistr[*cnt].bus, PCI_SLOT(pcistr[*cnt].device_fn), | 924 | pcistr[*cnt].pdev->bus->number, |
925 | PCI_SLOT(pcistr[*cnt].pdev->devfn), | ||
930 | pcistr[*cnt].irq, pcistr[*cnt].dpmem)); | 926 | pcistr[*cnt].irq, pcistr[*cnt].dpmem)); |
931 | (*cnt)++; | 927 | (*cnt)++; |
932 | } | 928 | } |
@@ -946,20 +942,20 @@ static void __init gdth_sort_pci(gdth_pci_str *pcistr, int cnt) | |||
946 | changed = FALSE; | 942 | changed = FALSE; |
947 | for (i = 0; i < cnt-1; ++i) { | 943 | for (i = 0; i < cnt-1; ++i) { |
948 | if (!reverse_scan) { | 944 | if (!reverse_scan) { |
949 | if ((pcistr[i].bus > pcistr[i+1].bus) || | 945 | if ((pcistr[i].pdev->bus->number > pcistr[i+1].pdev->bus->number) || |
950 | (pcistr[i].bus == pcistr[i+1].bus && | 946 | (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number && |
951 | PCI_SLOT(pcistr[i].device_fn) > | 947 | PCI_SLOT(pcistr[i].pdev->devfn) > |
952 | PCI_SLOT(pcistr[i+1].device_fn))) { | 948 | PCI_SLOT(pcistr[i+1].pdev->devfn))) { |
953 | temp = pcistr[i]; | 949 | temp = pcistr[i]; |
954 | pcistr[i] = pcistr[i+1]; | 950 | pcistr[i] = pcistr[i+1]; |
955 | pcistr[i+1] = temp; | 951 | pcistr[i+1] = temp; |
956 | changed = TRUE; | 952 | changed = TRUE; |
957 | } | 953 | } |
958 | } else { | 954 | } else { |
959 | if ((pcistr[i].bus < pcistr[i+1].bus) || | 955 | if ((pcistr[i].pdev->bus->number < pcistr[i+1].pdev->bus->number) || |
960 | (pcistr[i].bus == pcistr[i+1].bus && | 956 | (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number && |
961 | PCI_SLOT(pcistr[i].device_fn) < | 957 | PCI_SLOT(pcistr[i].pdev->devfn) < |
962 | PCI_SLOT(pcistr[i+1].device_fn))) { | 958 | PCI_SLOT(pcistr[i+1].pdev->devfn))) { |
963 | temp = pcistr[i]; | 959 | temp = pcistr[i]; |
964 | pcistr[i] = pcistr[i+1]; | 960 | pcistr[i] = pcistr[i+1]; |
965 | pcistr[i+1] = temp; | 961 | pcistr[i+1] = temp; |
@@ -1176,17 +1172,16 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) | |||
1176 | 1172 | ||
1177 | TRACE(("gdth_init_pci()\n")); | 1173 | TRACE(("gdth_init_pci()\n")); |
1178 | 1174 | ||
1179 | if (pcistr->vendor_id == PCI_VENDOR_ID_INTEL) | 1175 | if (pcistr->pdev->vendor == PCI_VENDOR_ID_INTEL) |
1180 | ha->oem_id = OEM_ID_INTEL; | 1176 | ha->oem_id = OEM_ID_INTEL; |
1181 | else | 1177 | else |
1182 | ha->oem_id = OEM_ID_ICP; | 1178 | ha->oem_id = OEM_ID_ICP; |
1183 | ha->brd_phys = (pcistr->bus << 8) | (pcistr->device_fn & 0xf8); | 1179 | ha->brd_phys = (pcistr->pdev->bus->number << 8) | (pcistr->pdev->devfn & 0xf8); |
1184 | ha->stype = (ulong32)pcistr->device_id; | 1180 | ha->stype = (ulong32)pcistr->pdev->device; |
1185 | ha->subdevice_id = pcistr->subdevice_id; | ||
1186 | ha->irq = pcistr->irq; | 1181 | ha->irq = pcistr->irq; |
1187 | ha->pdev = pcistr->pdev; | 1182 | ha->pdev = pcistr->pdev; |
1188 | 1183 | ||
1189 | if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ | 1184 | if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ |
1190 | TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); | 1185 | TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); |
1191 | ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); | 1186 | ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); |
1192 | if (ha->brd == NULL) { | 1187 | if (ha->brd == NULL) { |
@@ -1293,7 +1288,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) | |||
1293 | 1288 | ||
1294 | ha->dma64_support = 0; | 1289 | ha->dma64_support = 0; |
1295 | 1290 | ||
1296 | } else if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ | 1291 | } else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ |
1297 | ha->plx = (gdt6c_plx_regs *)pcistr->io; | 1292 | ha->plx = (gdt6c_plx_regs *)pcistr->io; |
1298 | TRACE2(("init_pci_new() dpmem %lx irq %d\n", | 1293 | TRACE2(("init_pci_new() dpmem %lx irq %d\n", |
1299 | pcistr->dpmem,ha->irq)); | 1294 | pcistr->dpmem,ha->irq)); |
@@ -4601,7 +4596,8 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) | |||
4601 | } | 4596 | } |
4602 | /* controller found and initialized */ | 4597 | /* controller found and initialized */ |
4603 | printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", | 4598 | printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", |
4604 | pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq); | 4599 | pcistr[ctr].pdev->bus->number, |
4600 | PCI_SLOT(pcistr[ctr].pdev->devfn), ha->irq); | ||
4605 | 4601 | ||
4606 | if (request_irq(ha->irq, gdth_interrupt, | 4602 | if (request_irq(ha->irq, gdth_interrupt, |
4607 | IRQF_DISABLED|IRQF_SHARED, "gdth", ha)) | 4603 | IRQF_DISABLED|IRQF_SHARED, "gdth", ha)) |
@@ -4637,7 +4633,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) | |||
4637 | #endif | 4633 | #endif |
4638 | ha->scratch_busy = FALSE; | 4634 | ha->scratch_busy = FALSE; |
4639 | ha->req_first = NULL; | 4635 | ha->req_first = NULL; |
4640 | ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES; | 4636 | ha->tid_cnt = pcistr[ctr].pdev->device >= 0x200 ? MAXID : MAX_HDRIVES; |
4641 | if (max_ids > 0 && max_ids < ha->tid_cnt) | 4637 | if (max_ids > 0 && max_ids < ha->tid_cnt) |
4642 | ha->tid_cnt = max_ids; | 4638 | ha->tid_cnt = max_ids; |
4643 | for (i=0; i<GDTH_MAXCMDS; ++i) | 4639 | for (i=0; i<GDTH_MAXCMDS; ++i) |
@@ -4810,7 +4806,7 @@ static const char *gdth_ctr_name(int hanum) | |||
4810 | } else if (ha->type == GDT_ISA) { | 4806 | } else if (ha->type == GDT_ISA) { |
4811 | return("GDT2000/2020"); | 4807 | return("GDT2000/2020"); |
4812 | } else if (ha->type == GDT_PCI) { | 4808 | } else if (ha->type == GDT_PCI) { |
4813 | switch (ha->stype) { | 4809 | switch (ha->pdev->device) { |
4814 | case PCI_DEVICE_ID_VORTEX_GDT60x0: | 4810 | case PCI_DEVICE_ID_VORTEX_GDT60x0: |
4815 | return("GDT6000/6020/6050"); | 4811 | return("GDT6000/6020/6050"); |
4816 | case PCI_DEVICE_ID_VORTEX_GDT6000B: | 4812 | case PCI_DEVICE_ID_VORTEX_GDT6000B: |
@@ -5448,12 +5444,12 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
5448 | ctrt.type = | 5444 | ctrt.type = |
5449 | (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); | 5445 | (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); |
5450 | if (ha->stype >= 0x300) | 5446 | if (ha->stype >= 0x300) |
5451 | ctrt.ext_type = 0x6000 | ha->subdevice_id; | 5447 | ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device; |
5452 | else | 5448 | else |
5453 | ctrt.ext_type = 0x6000 | ha->stype; | 5449 | ctrt.ext_type = 0x6000 | ha->stype; |
5454 | } | 5450 | } |
5455 | ctrt.device_id = ha->stype; | 5451 | ctrt.device_id = ha->pdev->device; |
5456 | ctrt.sub_device_id = ha->subdevice_id; | 5452 | ctrt.sub_device_id = ha->pdev->subsystem_device; |
5457 | } | 5453 | } |
5458 | ctrt.info = ha->brd_phys; | 5454 | ctrt.info = ha->brd_phys; |
5459 | ctrt.oem_id = ha->oem_id; | 5455 | ctrt.oem_id = ha->oem_id; |
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h index 8c29eafd51c5..37423300592e 100644 --- a/drivers/scsi/gdth.h +++ b/drivers/scsi/gdth.h | |||
@@ -845,11 +845,6 @@ typedef struct { | |||
845 | /* PCI resources */ | 845 | /* PCI resources */ |
846 | typedef struct { | 846 | typedef struct { |
847 | struct pci_dev *pdev; | 847 | struct pci_dev *pdev; |
848 | ushort vendor_id; /* vendor (ICP, Intel, ..) */ | ||
849 | ushort device_id; /* device ID (0,..,9) */ | ||
850 | ushort subdevice_id; /* sub device ID */ | ||
851 | unchar bus; /* PCI bus */ | ||
852 | unchar device_fn; /* PCI device/function no. */ | ||
853 | ulong dpmem; /* DPRAM address */ | 848 | ulong dpmem; /* DPRAM address */ |
854 | ulong io; /* IO address */ | 849 | ulong io; /* IO address */ |
855 | ulong io_mm; /* IO address mem. mapped */ | 850 | ulong io_mm; /* IO address mem. mapped */ |
@@ -862,7 +857,6 @@ typedef struct { | |||
862 | ushort oem_id; /* OEM */ | 857 | ushort oem_id; /* OEM */ |
863 | ushort type; /* controller class */ | 858 | ushort type; /* controller class */ |
864 | ulong32 stype; /* subtype (PCI: device ID) */ | 859 | ulong32 stype; /* subtype (PCI: device ID) */ |
865 | ushort subdevice_id; /* sub device ID (PCI) */ | ||
866 | ushort fw_vers; /* firmware version */ | 860 | ushort fw_vers; /* firmware version */ |
867 | ushort cache_feat; /* feat. cache serv. (s/g,..)*/ | 861 | ushort cache_feat; /* feat. cache serv. (s/g,..)*/ |
868 | ushort raw_feat; /* feat. raw service (s/g,..)*/ | 862 | ushort raw_feat; /* feat. raw service (s/g,..)*/ |