summaryrefslogtreecommitdiffstats
path: root/drivers/ide/mips
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-16 20:33:44 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-16 20:33:44 +0200
commitcb8ea0929c9cb899d61c4e155aace0b34d8cffe3 (patch)
tree64fda0c4350756122f0a2af3a48fd92c2cdf60cc /drivers/ide/mips
parent67717e224181527987cce800fa2ddb5c8c1e9315 (diff)
downloadlinux-cb8ea0929c9cb899d61c4e155aace0b34d8cffe3.tar.gz
linux-cb8ea0929c9cb899d61c4e155aace0b34d8cffe3.tar.bz2
linux-cb8ea0929c9cb899d61c4e155aace0b34d8cffe3.zip
swarm: call ide_find_port_slot() later
Move ide_find_port_slot() call closer to ide_device_add(). This is basically a preparation for the future changes. Cc: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/mips')
-rw-r--r--drivers/ide/mips/swarm.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index bae92acea343..9f1212cc4aed 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -82,10 +82,6 @@ static int __devinit swarm_ide_probe(struct device *dev)
if (!SIBYTE_HAVE_IDE)
return -ENODEV;
- hwif = ide_find_port_slot(&swarm_port_info);
- if (hwif == NULL)
- return -ENOMEM;
-
base = ioremap(A_IO_EXT_BASE, 0x800);
offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
@@ -112,9 +108,6 @@ static int __devinit swarm_ide_probe(struct device *dev)
base = ioremap(offset, size);
- /* Setup MMIO ops. */
- default_hwif_mmiops(hwif);
-
for (i = 0; i <= 7; i++)
hw.io_ports_array[i] =
(unsigned long)(base + ((0x1f0 + i) << 5));
@@ -123,8 +116,15 @@ static int __devinit swarm_ide_probe(struct device *dev)
hw.irq = K_INT_GB_IDE;
hw.chipset = ide_generic;
+ hwif = ide_find_port_slot(&swarm_port_info);
+ if (hwif == NULL)
+ goto err;
+
ide_init_port_hw(hwif, &hw);
+ /* Setup MMIO ops. */
+ default_hwif_mmiops(hwif);
+
idx[0] = hwif->index;
ide_device_add(idx, &swarm_port_info);
@@ -132,6 +132,10 @@ static int __devinit swarm_ide_probe(struct device *dev)
dev_set_drvdata(dev, hwif);
return 0;
+err:
+ release_resource(&swarm_ide_resource);
+ iounmap(base);
+ return -ENOMEM;
}
static struct device_driver swarm_ide_driver = {