Commit 0af08e0e authored by James Bottomley's avatar James Bottomley

Fix NCR_D700 driver

This should complete the hch conversion to the new style probing.
Tested and works fine.
parent 4d4ffdcf
...@@ -169,16 +169,18 @@ struct NCR_D700_private { ...@@ -169,16 +169,18 @@ struct NCR_D700_private {
struct Scsi_Host *hosts[2]; struct Scsi_Host *hosts[2];
}; };
static int NCR_D700_probe_one(struct NCR_D700_private *p, int chan, static int
NCR_D700_probe_one(struct NCR_D700_private *p, int siop,
int irq, int slot, u32 region, int differential) int irq, int slot, u32 region, int differential)
{ {
struct NCR_700_Host_Parameters *hostdata; struct NCR_700_Host_Parameters *hostdata;
struct Scsi_Host *host; struct Scsi_Host *host;
int ret;
hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL); hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL);
if (!hostdata) { if (!hostdata) {
printk(KERN_ERR "NCR D700: Failed to allocate host data " printk(KERN_ERR "NCR D700: SIOP%d: Failed to allocate host"
"for channel %d, detatching\n", chan); "data, detatching\n", siop);
return -ENOMEM; return -ENOMEM;
} }
memset(hostdata, 0, sizeof(*hostdata)); memset(hostdata, 0, sizeof(*hostdata));
...@@ -186,41 +188,49 @@ static int NCR_D700_probe_one(struct NCR_D700_private *p, int chan, ...@@ -186,41 +188,49 @@ static int NCR_D700_probe_one(struct NCR_D700_private *p, int chan,
if (!request_region(region, 64, "NCR_D700")) { if (!request_region(region, 64, "NCR_D700")) {
printk(KERN_ERR "NCR D700: Failed to reserve IO region 0x%x\n", printk(KERN_ERR "NCR D700: Failed to reserve IO region 0x%x\n",
region); region);
kfree(hostdata); ret = -ENODEV;
return -ENODEV; goto region_failed;
} }
/* Fill in the three required pieces of hostdata */ /* Fill in the three required pieces of hostdata */
hostdata->base = region; hostdata->base = region;
hostdata->differential = (((1<<chan) & differential) != 0); hostdata->differential = (((1<<siop) & differential) != 0);
hostdata->clock = NCR_D700_CLOCK_MHZ; hostdata->clock = NCR_D700_CLOCK_MHZ;
/* and register the chip */ /* and register the siop */
host = NCR_700_detect(&NCR_D700_driver_template, hostdata); host = NCR_700_detect(&NCR_D700_driver_template, hostdata);
if (!host) { if (!host) {
kfree(hostdata); ret = -ENOMEM;
release_region(host->base, 64); goto detect_failed;
return -ENOMEM;
} }
host->irq = irq; host->irq = irq;
/* FIXME: Read this from SUS */ /* FIXME: Read this from SUS */
host->this_id = id_array[slot * 2 + chan]; host->this_id = id_array[slot * 2 + siop];
printk(KERN_NOTICE "NCR D700: SIOP%d, SCSI id is %d\n", printk(KERN_NOTICE "NCR D700: SIOP%d, SCSI id is %d\n",
chan, host->this_id); siop, host->this_id);
if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "NCR_D700", host)) { if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "NCR_D700", host)) {
printk(KERN_ERR "NCR D700, channel %d: irq problem, " printk(KERN_ERR "NCR D700: SIOP%d: irq problem, "
"detatching\n", chan); "detatching\n", siop);
scsi_unregister(host); ret = -ENODEV;
NCR_700_release(host); goto irq_failed;
return -ENODEV;
} }
scsi_add_host(host, NULL); scsi_add_host(host, p->dev);
p->hosts[chan] = host; p->hosts[siop] = host;
hostdata->dev = p->dev; hostdata->dev = p->dev;
return 0; return 0;
irq_failed:
scsi_unregister(host);
NCR_700_release(host);
detect_failed:
release_region(host->base, 64);
region_failed:
kfree(hostdata);
return ret;
} }
/* Detect a D700 card. Note, because of the setup --- the chips are /* Detect a D700 card. Note, because of the setup --- the chips are
...@@ -305,8 +315,15 @@ NCR_D700_probe(struct device *dev) ...@@ -305,8 +315,15 @@ NCR_D700_probe(struct device *dev)
/* plumb in both 700 chips */ /* plumb in both 700 chips */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
found |= NCR_D700_probe_one(p, i, irq, slot, int err;
offset_addr | (0x80 * i), differential);
if ((err = NCR_D700_probe_one(p, i, irq, slot,
offset_addr + (0x80 * i),
differential)) != 0)
printk("D700: SIOP%d: probe failed, error = %d\n",
i, err);
else
found++;
} }
if (!found) { if (!found) {
......
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