Commit 8e9a8a0d authored by Jeff Garzik's avatar Jeff Garzik Committed by James Bottomley

[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: default avatarJeff Garzik <jeff@garzik.org>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarAchim Leubner <Achim_Leubner@adaptec.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 7603e02e
...@@ -902,11 +902,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, ...@@ -902,11 +902,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
return; return;
/* GDT PCI controller found, resources are already in pdev */ /* GDT PCI controller found, resources are already in pdev */
pcistr[*cnt].pdev = pdev; pcistr[*cnt].pdev = pdev;
pcistr[*cnt].vendor_id = vendor;
pcistr[*cnt].device_id = device;
pcistr[*cnt].subdevice_id = pdev->subsystem_device;
pcistr[*cnt].bus = pdev->bus->number;
pcistr[*cnt].device_fn = pdev->devfn;
pcistr[*cnt].irq = pdev->irq; pcistr[*cnt].irq = pdev->irq;
base0 = pci_resource_flags(pdev, 0); base0 = pci_resource_flags(pdev, 0);
base1 = pci_resource_flags(pdev, 1); base1 = pci_resource_flags(pdev, 1);
...@@ -926,7 +921,8 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, ...@@ -926,7 +921,8 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
pcistr[*cnt].io = pci_resource_start(pdev, 1); pcistr[*cnt].io = pci_resource_start(pdev, 1);
} }
TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n",
pcistr[*cnt].bus, PCI_SLOT(pcistr[*cnt].device_fn), pcistr[*cnt].pdev->bus->number,
PCI_SLOT(pcistr[*cnt].pdev->devfn),
pcistr[*cnt].irq, pcistr[*cnt].dpmem)); pcistr[*cnt].irq, pcistr[*cnt].dpmem));
(*cnt)++; (*cnt)++;
} }
...@@ -946,20 +942,20 @@ static void __init gdth_sort_pci(gdth_pci_str *pcistr, int cnt) ...@@ -946,20 +942,20 @@ static void __init gdth_sort_pci(gdth_pci_str *pcistr, int cnt)
changed = FALSE; changed = FALSE;
for (i = 0; i < cnt-1; ++i) { for (i = 0; i < cnt-1; ++i) {
if (!reverse_scan) { if (!reverse_scan) {
if ((pcistr[i].bus > pcistr[i+1].bus) || if ((pcistr[i].pdev->bus->number > pcistr[i+1].pdev->bus->number) ||
(pcistr[i].bus == pcistr[i+1].bus && (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number &&
PCI_SLOT(pcistr[i].device_fn) > PCI_SLOT(pcistr[i].pdev->devfn) >
PCI_SLOT(pcistr[i+1].device_fn))) { PCI_SLOT(pcistr[i+1].pdev->devfn))) {
temp = pcistr[i]; temp = pcistr[i];
pcistr[i] = pcistr[i+1]; pcistr[i] = pcistr[i+1];
pcistr[i+1] = temp; pcistr[i+1] = temp;
changed = TRUE; changed = TRUE;
} }
} else { } else {
if ((pcistr[i].bus < pcistr[i+1].bus) || if ((pcistr[i].pdev->bus->number < pcistr[i+1].pdev->bus->number) ||
(pcistr[i].bus == pcistr[i+1].bus && (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number &&
PCI_SLOT(pcistr[i].device_fn) < PCI_SLOT(pcistr[i].pdev->devfn) <
PCI_SLOT(pcistr[i+1].device_fn))) { PCI_SLOT(pcistr[i+1].pdev->devfn))) {
temp = pcistr[i]; temp = pcistr[i];
pcistr[i] = pcistr[i+1]; pcistr[i] = pcistr[i+1];
pcistr[i+1] = temp; pcistr[i+1] = temp;
...@@ -1176,17 +1172,16 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) ...@@ -1176,17 +1172,16 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
TRACE(("gdth_init_pci()\n")); TRACE(("gdth_init_pci()\n"));
if (pcistr->vendor_id == PCI_VENDOR_ID_INTEL) if (pcistr->pdev->vendor == PCI_VENDOR_ID_INTEL)
ha->oem_id = OEM_ID_INTEL; ha->oem_id = OEM_ID_INTEL;
else else
ha->oem_id = OEM_ID_ICP; ha->oem_id = OEM_ID_ICP;
ha->brd_phys = (pcistr->bus << 8) | (pcistr->device_fn & 0xf8); ha->brd_phys = (pcistr->pdev->bus->number << 8) | (pcistr->pdev->devfn & 0xf8);
ha->stype = (ulong32)pcistr->device_id; ha->stype = (ulong32)pcistr->pdev->device;
ha->subdevice_id = pcistr->subdevice_id;
ha->irq = pcistr->irq; ha->irq = pcistr->irq;
ha->pdev = pcistr->pdev; ha->pdev = pcistr->pdev;
if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */
TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq));
ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str));
if (ha->brd == NULL) { if (ha->brd == NULL) {
...@@ -1293,7 +1288,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) ...@@ -1293,7 +1288,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
ha->dma64_support = 0; ha->dma64_support = 0;
} else if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ } else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */
ha->plx = (gdt6c_plx_regs *)pcistr->io; ha->plx = (gdt6c_plx_regs *)pcistr->io;
TRACE2(("init_pci_new() dpmem %lx irq %d\n", TRACE2(("init_pci_new() dpmem %lx irq %d\n",
pcistr->dpmem,ha->irq)); pcistr->dpmem,ha->irq));
...@@ -4601,7 +4596,8 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) ...@@ -4601,7 +4596,8 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
} }
/* controller found and initialized */ /* controller found and initialized */
printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n", printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n",
pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq); pcistr[ctr].pdev->bus->number,
PCI_SLOT(pcistr[ctr].pdev->devfn), ha->irq);
if (request_irq(ha->irq, gdth_interrupt, if (request_irq(ha->irq, gdth_interrupt,
IRQF_DISABLED|IRQF_SHARED, "gdth", ha)) IRQF_DISABLED|IRQF_SHARED, "gdth", ha))
...@@ -4637,7 +4633,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) ...@@ -4637,7 +4633,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
#endif #endif
ha->scratch_busy = FALSE; ha->scratch_busy = FALSE;
ha->req_first = NULL; ha->req_first = NULL;
ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES; ha->tid_cnt = pcistr[ctr].pdev->device >= 0x200 ? MAXID : MAX_HDRIVES;
if (max_ids > 0 && max_ids < ha->tid_cnt) if (max_ids > 0 && max_ids < ha->tid_cnt)
ha->tid_cnt = max_ids; ha->tid_cnt = max_ids;
for (i=0; i<GDTH_MAXCMDS; ++i) for (i=0; i<GDTH_MAXCMDS; ++i)
...@@ -4810,7 +4806,7 @@ static const char *gdth_ctr_name(int hanum) ...@@ -4810,7 +4806,7 @@ static const char *gdth_ctr_name(int hanum)
} else if (ha->type == GDT_ISA) { } else if (ha->type == GDT_ISA) {
return("GDT2000/2020"); return("GDT2000/2020");
} else if (ha->type == GDT_PCI) { } else if (ha->type == GDT_PCI) {
switch (ha->stype) { switch (ha->pdev->device) {
case PCI_DEVICE_ID_VORTEX_GDT60x0: case PCI_DEVICE_ID_VORTEX_GDT60x0:
return("GDT6000/6020/6050"); return("GDT6000/6020/6050");
case PCI_DEVICE_ID_VORTEX_GDT6000B: case PCI_DEVICE_ID_VORTEX_GDT6000B:
...@@ -5448,12 +5444,12 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, ...@@ -5448,12 +5444,12 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
ctrt.type = ctrt.type =
(ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe);
if (ha->stype >= 0x300) if (ha->stype >= 0x300)
ctrt.ext_type = 0x6000 | ha->subdevice_id; ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device;
else else
ctrt.ext_type = 0x6000 | ha->stype; ctrt.ext_type = 0x6000 | ha->stype;
} }
ctrt.device_id = ha->stype; ctrt.device_id = ha->pdev->device;
ctrt.sub_device_id = ha->subdevice_id; ctrt.sub_device_id = ha->pdev->subsystem_device;
} }
ctrt.info = ha->brd_phys; ctrt.info = ha->brd_phys;
ctrt.oem_id = ha->oem_id; ctrt.oem_id = ha->oem_id;
......
...@@ -845,11 +845,6 @@ typedef struct { ...@@ -845,11 +845,6 @@ typedef struct {
/* PCI resources */ /* PCI resources */
typedef struct { typedef struct {
struct pci_dev *pdev; struct pci_dev *pdev;
ushort vendor_id; /* vendor (ICP, Intel, ..) */
ushort device_id; /* device ID (0,..,9) */
ushort subdevice_id; /* sub device ID */
unchar bus; /* PCI bus */
unchar device_fn; /* PCI device/function no. */
ulong dpmem; /* DPRAM address */ ulong dpmem; /* DPRAM address */
ulong io; /* IO address */ ulong io; /* IO address */
ulong io_mm; /* IO address mem. mapped */ ulong io_mm; /* IO address mem. mapped */
...@@ -862,7 +857,6 @@ typedef struct { ...@@ -862,7 +857,6 @@ typedef struct {
ushort oem_id; /* OEM */ ushort oem_id; /* OEM */
ushort type; /* controller class */ ushort type; /* controller class */
ulong32 stype; /* subtype (PCI: device ID) */ ulong32 stype; /* subtype (PCI: device ID) */
ushort subdevice_id; /* sub device ID (PCI) */
ushort fw_vers; /* firmware version */ ushort fw_vers; /* firmware version */
ushort cache_feat; /* feat. cache serv. (s/g,..)*/ ushort cache_feat; /* feat. cache serv. (s/g,..)*/
ushort raw_feat; /* feat. raw service (s/g,..)*/ ushort raw_feat; /* feat. raw service (s/g,..)*/
......
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