aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-16 14:33:44 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-16 14:33:44 -0400
commitcb8ea0929c9cb899d61c4e155aace0b34d8cffe3 (patch)
tree64fda0c4350756122f0a2af3a48fd92c2cdf60cc
parent67717e224181527987cce800fa2ddb5c8c1e9315 (diff)
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>
-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)
82 if (!SIBYTE_HAVE_IDE) 82 if (!SIBYTE_HAVE_IDE)
83 return -ENODEV; 83 return -ENODEV;
84 84
85 hwif = ide_find_port_slot(&swarm_port_info);
86 if (hwif == NULL)
87 return -ENOMEM;
88
89 base = ioremap(A_IO_EXT_BASE, 0x800); 85 base = ioremap(A_IO_EXT_BASE, 0x800);
90 offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); 86 offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
91 size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); 87 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)
112 108
113 base = ioremap(offset, size); 109 base = ioremap(offset, size);
114 110
115 /* Setup MMIO ops. */
116 default_hwif_mmiops(hwif);
117
118 for (i = 0; i <= 7; i++) 111 for (i = 0; i <= 7; i++)
119 hw.io_ports_array[i] = 112 hw.io_ports_array[i] =
120 (unsigned long)(base + ((0x1f0 + i) << 5)); 113 (unsigned long)(base + ((0x1f0 + i) << 5));
@@ -123,8 +116,15 @@ static int __devinit swarm_ide_probe(struct device *dev)
123 hw.irq = K_INT_GB_IDE; 116 hw.irq = K_INT_GB_IDE;
124 hw.chipset = ide_generic; 117 hw.chipset = ide_generic;
125 118
119 hwif = ide_find_port_slot(&swarm_port_info);
120 if (hwif == NULL)
121 goto err;
122
126 ide_init_port_hw(hwif, &hw); 123 ide_init_port_hw(hwif, &hw);
127 124
125 /* Setup MMIO ops. */
126 default_hwif_mmiops(hwif);
127
128 idx[0] = hwif->index; 128 idx[0] = hwif->index;
129 129
130 ide_device_add(idx, &swarm_port_info); 130 ide_device_add(idx, &swarm_port_info);
@@ -132,6 +132,10 @@ static int __devinit swarm_ide_probe(struct device *dev)
132 dev_set_drvdata(dev, hwif); 132 dev_set_drvdata(dev, hwif);
133 133
134 return 0; 134 return 0;
135err:
136 release_resource(&swarm_ide_resource);
137 iounmap(base);
138 return -ENOMEM;
135} 139}
136 140
137static struct device_driver swarm_ide_driver = { 141static struct device_driver swarm_ide_driver = {