aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:39 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:39 -0500
commit9e016a719209d95338e314b46c3012cc7feaaeec (patch)
treecc19b160cfb6210385fbf29890351f9ca2ba73df /drivers/ide/legacy
parentf82c2b171905b6d5af92395d8159546351ab602f (diff)
ide: add ide_deprecated_find_port() helper
* Factor out code for finding ide_hwifs[] slot from ide_register_hw() to ide_deprecated_find_port(). * Convert bast-ide, ide-cs and delkin_cb host drivers to use ide_device_add() instead of ide_register_hw() (while at it drop doing "ide_unregister()" loop which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot cannot be find). This patch leaves us with only two ide_register_hw() users: - drivers/macintosh/mediabay.c - drivers/ide/ide.c Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/ide-cs.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 2d772e2bebb3..38e87ad211e0 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -145,13 +145,36 @@ static void ide_detach(struct pcmcia_device *link)
145 145
146static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) 146static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle)
147{ 147{
148 ide_hwif_t *hwif;
148 hw_regs_t hw; 149 hw_regs_t hw;
150 int i;
151 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
152
149 memset(&hw, 0, sizeof(hw)); 153 memset(&hw, 0, sizeof(hw));
150 ide_init_hwif_ports(&hw, io, ctl, NULL); 154 ide_init_hwif_ports(&hw, io, ctl, NULL);
151 hw.irq = irq; 155 hw.irq = irq;
152 hw.chipset = ide_pci; 156 hw.chipset = ide_pci;
153 hw.dev = &handle->dev; 157 hw.dev = &handle->dev;
154 return ide_register_hw(&hw, &ide_undecoded_slave, NULL); 158
159 hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
160 if (hwif == NULL)
161 return -1;
162
163 i = hwif->index;
164
165 if (hwif->present)
166 ide_unregister(i, 0, 1);
167 else if (!hwif->hold)
168 ide_init_port_data(hwif, i);
169
170 ide_init_port_hw(hwif, &hw);
171 hwif->quirkproc = &ide_undecoded_slave;
172
173 idx[0] = i;
174
175 ide_device_add(idx, NULL);
176
177 return hwif->present ? i : -1;
155} 178}
156 179
157/*====================================================================== 180/*======================================================================