aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/ide-cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/legacy/ide-cs.c')
-rw-r--r--drivers/ide/legacy/ide-cs.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index f93d5454ebf8..1a4b9e6887fa 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -74,7 +74,7 @@ INT_MODULE_PARM(pc_debug, 0);
74 74
75typedef struct ide_info_t { 75typedef struct ide_info_t {
76 struct pcmcia_device *p_dev; 76 struct pcmcia_device *p_dev;
77 ide_hwif_t *hwif; 77 struct ide_host *host;
78 int ndev; 78 int ndev;
79 dev_node_t node; 79 dev_node_t node;
80} ide_info_t; 80} ide_info_t;
@@ -132,7 +132,7 @@ static int ide_probe(struct pcmcia_device *link)
132static void ide_detach(struct pcmcia_device *link) 132static void ide_detach(struct pcmcia_device *link)
133{ 133{
134 ide_info_t *info = link->priv; 134 ide_info_t *info = link->priv;
135 ide_hwif_t *hwif = info->hwif; 135 ide_hwif_t *hwif = info->host->ports[0];
136 unsigned long data_addr, ctl_addr; 136 unsigned long data_addr, ctl_addr;
137 137
138 DEBUG(0, "ide_detach(0x%p)\n", link); 138 DEBUG(0, "ide_detach(0x%p)\n", link);
@@ -157,13 +157,13 @@ static const struct ide_port_info idecs_port_info = {
157 .host_flags = IDE_HFLAG_NO_DMA, 157 .host_flags = IDE_HFLAG_NO_DMA,
158}; 158};
159 159
160static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl, 160static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
161 unsigned long irq, struct pcmcia_device *handle) 161 unsigned long irq, struct pcmcia_device *handle)
162{ 162{
163 struct ide_host *host;
163 ide_hwif_t *hwif; 164 ide_hwif_t *hwif;
164 int i; 165 int i;
165 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 166 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
166 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
167 167
168 if (!request_region(io, 8, DRV_NAME)) { 168 if (!request_region(io, 8, DRV_NAME)) {
169 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", 169 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
@@ -184,26 +184,26 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl,
184 hw.chipset = ide_pci; 184 hw.chipset = ide_pci;
185 hw.dev = &handle->dev; 185 hw.dev = &handle->dev;
186 186
187 hwif = ide_find_port(); 187 host = ide_host_alloc(&idecs_port_info, hws);
188 if (hwif == NULL) 188 if (host == NULL)
189 goto out_release; 189 goto out_release;
190 190
191 idx[0] = hwif->index; 191 ide_host_register(host, &idecs_port_info, hws);
192 192
193 ide_device_add(idx, &idecs_port_info, hws); 193 hwif = host->ports[0];
194 194
195 if (hwif->present) 195 if (hwif->present)
196 return hwif; 196 return host;
197 197
198 /* retry registration in case device is still spinning up */ 198 /* retry registration in case device is still spinning up */
199 for (i = 0; i < 10; i++) { 199 for (i = 0; i < 10; i++) {
200 msleep(100); 200 msleep(100);
201 ide_port_scan(hwif); 201 ide_port_scan(hwif);
202 if (hwif->present) 202 if (hwif->present)
203 return hwif; 203 return host;
204 } 204 }
205 205
206 return hwif; 206 return host;
207 207
208out_release: 208out_release:
209 release_region(ctl, 1); 209 release_region(ctl, 1);
@@ -235,7 +235,7 @@ static int ide_config(struct pcmcia_device *link)
235 cistpl_cftable_entry_t *cfg; 235 cistpl_cftable_entry_t *cfg;
236 int pass, last_ret = 0, last_fn = 0, is_kme = 0; 236 int pass, last_ret = 0, last_fn = 0, is_kme = 0;
237 unsigned long io_base, ctl_base; 237 unsigned long io_base, ctl_base;
238 ide_hwif_t *hwif; 238 struct ide_host *host;
239 239
240 DEBUG(0, "ide_config(0x%p)\n", link); 240 DEBUG(0, "ide_config(0x%p)\n", link);
241 241
@@ -330,21 +330,21 @@ static int ide_config(struct pcmcia_device *link)
330 if (is_kme) 330 if (is_kme)
331 outb(0x81, ctl_base+1); 331 outb(0x81, ctl_base+1);
332 332
333 hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); 333 host = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
334 if (hwif == NULL && link->io.NumPorts1 == 0x20) { 334 if (host == NULL && link->io.NumPorts1 == 0x20) {
335 outb(0x02, ctl_base + 0x10); 335 outb(0x02, ctl_base + 0x10);
336 hwif = idecs_register(io_base + 0x10, ctl_base + 0x10, 336 host = idecs_register(io_base + 0x10, ctl_base + 0x10,
337 link->irq.AssignedIRQ, link); 337 link->irq.AssignedIRQ, link);
338 } 338 }
339 339
340 if (hwif == NULL) 340 if (host == NULL)
341 goto failed; 341 goto failed;
342 342
343 info->ndev = 1; 343 info->ndev = 1;
344 sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2); 344 sprintf(info->node.dev_name, "hd%c", 'a' + host->ports[0]->index * 2);
345 info->node.major = hwif->major; 345 info->node.major = host->ports[0]->major;
346 info->node.minor = 0; 346 info->node.minor = 0;
347 info->hwif = hwif; 347 info->host = host;
348 link->dev_node = &info->node; 348 link->dev_node = &info->node;
349 printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", 349 printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n",
350 info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); 350 info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10);
@@ -375,15 +375,15 @@ failed:
375static void ide_release(struct pcmcia_device *link) 375static void ide_release(struct pcmcia_device *link)
376{ 376{
377 ide_info_t *info = link->priv; 377 ide_info_t *info = link->priv;
378 ide_hwif_t *hwif = info->hwif; 378 struct ide_host *host = info->host;
379 379
380 DEBUG(0, "ide_release(0x%p)\n", link); 380 DEBUG(0, "ide_release(0x%p)\n", link);
381 381
382 if (info->ndev) { 382 if (info->ndev)
383 /* FIXME: if this fails we need to queue the cleanup somehow 383 /* FIXME: if this fails we need to queue the cleanup somehow
384 -- need to investigate the required PCMCIA magic */ 384 -- need to investigate the required PCMCIA magic */
385 ide_unregister(hwif); 385 ide_host_remove(host);
386 } 386
387 info->ndev = 0; 387 info->ndev = 0;
388 388
389 pcmcia_disable_device(link); 389 pcmcia_disable_device(link);