diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:14 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:14 -0400 |
commit | ac95beedf8bc97b24f9540d4da9952f07221c023 (patch) | |
tree | c29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/legacy/qd65xx.c | |
parent | 4a27214d7be31e122db4102166f49ec15958e8e9 (diff) |
ide: add struct ide_port_ops (take 2)
* Move hooks for port/host specific methods from ide_hwif_t to
'struct ide_port_ops'.
* Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
and ide_hwif_t.
* Update host drivers and core code accordingly.
While at it:
* Rename ata66_*() cable detect functions to *_cable_detect() to match
the standard naming. (Suggested by Sergei Shtylyov)
v2:
* Fix build for bast-ide. (Noticed by Andrew Morton)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy/qd65xx.c')
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 6e820c7c5c6b..65f098d15154 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -304,6 +304,18 @@ static void __init qd6580_port_init_devs(ide_hwif_t *hwif) | |||
304 | hwif->drives[1].drive_data = t2; | 304 | hwif->drives[1].drive_data = t2; |
305 | } | 305 | } |
306 | 306 | ||
307 | static const struct ide_port_ops qd6500_port_ops = { | ||
308 | .port_init_devs = qd6500_port_init_devs, | ||
309 | .set_pio_mode = qd6500_set_pio_mode, | ||
310 | .selectproc = qd65xx_select, | ||
311 | }; | ||
312 | |||
313 | static const struct ide_port_ops qd6580_port_ops = { | ||
314 | .port_init_devs = qd6580_port_init_devs, | ||
315 | .set_pio_mode = qd6580_set_pio_mode, | ||
316 | .selectproc = qd65xx_select, | ||
317 | }; | ||
318 | |||
307 | static const struct ide_port_info qd65xx_port_info __initdata = { | 319 | static const struct ide_port_info qd65xx_port_info __initdata = { |
308 | .chipset = ide_qd65xx, | 320 | .chipset = ide_qd65xx, |
309 | .host_flags = IDE_HFLAG_IO_32BIT | | 321 | .host_flags = IDE_HFLAG_IO_32BIT | |
@@ -361,6 +373,7 @@ static int __init qd_probe(int base) | |||
361 | printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n", | 373 | printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n", |
362 | config, QD_ID3); | 374 | config, QD_ID3); |
363 | 375 | ||
376 | d.port_ops = &qd6500_port_ops; | ||
364 | d.host_flags |= IDE_HFLAG_SINGLE; | 377 | d.host_flags |= IDE_HFLAG_SINGLE; |
365 | 378 | ||
366 | hwif = ide_find_port_slot(&d); | 379 | hwif = ide_find_port_slot(&d); |
@@ -371,10 +384,6 @@ static int __init qd_probe(int base) | |||
371 | 384 | ||
372 | hwif->config_data = (base << 8) | config; | 385 | hwif->config_data = (base << 8) | config; |
373 | 386 | ||
374 | hwif->port_init_devs = qd6500_port_init_devs; | ||
375 | hwif->set_pio_mode = qd6500_set_pio_mode; | ||
376 | hwif->selectproc = qd65xx_select; | ||
377 | |||
378 | idx[unit] = hwif->index; | 387 | idx[unit] = hwif->index; |
379 | 388 | ||
380 | ide_device_add(idx, &d); | 389 | ide_device_add(idx, &d); |
@@ -400,6 +409,8 @@ static int __init qd_probe(int base) | |||
400 | 409 | ||
401 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); | 410 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); |
402 | 411 | ||
412 | d.port_ops = &qd6580_port_ops; | ||
413 | |||
403 | if (control & QD_CONTR_SEC_DISABLED) { | 414 | if (control & QD_CONTR_SEC_DISABLED) { |
404 | /* secondary disabled */ | 415 | /* secondary disabled */ |
405 | 416 | ||
@@ -415,10 +426,6 @@ static int __init qd_probe(int base) | |||
415 | 426 | ||
416 | hwif->config_data = (base << 8) | config; | 427 | hwif->config_data = (base << 8) | config; |
417 | 428 | ||
418 | hwif->port_init_devs = qd6580_port_init_devs; | ||
419 | hwif->set_pio_mode = qd6580_set_pio_mode; | ||
420 | hwif->selectproc = qd65xx_select; | ||
421 | |||
422 | idx[unit] = hwif->index; | 429 | idx[unit] = hwif->index; |
423 | 430 | ||
424 | ide_device_add(idx, &d); | 431 | ide_device_add(idx, &d); |
@@ -433,24 +440,16 @@ static int __init qd_probe(int base) | |||
433 | hwif = ide_find_port(); | 440 | hwif = ide_find_port(); |
434 | if (hwif) { | 441 | if (hwif) { |
435 | ide_init_port_hw(hwif, &hw[0]); | 442 | ide_init_port_hw(hwif, &hw[0]); |
436 | hwif->config_data = (base << 8) | config; | ||
437 | hwif->port_init_devs = qd6580_port_init_devs; | ||
438 | hwif->set_pio_mode = qd6580_set_pio_mode; | ||
439 | hwif->selectproc = qd65xx_select; | ||
440 | idx[0] = hwif->index; | 443 | idx[0] = hwif->index; |
441 | } | 444 | } |
442 | 445 | ||
443 | mate = ide_find_port(); | 446 | mate = ide_find_port(); |
444 | if (mate) { | 447 | if (mate) { |
445 | ide_init_port_hw(mate, &hw[1]); | 448 | ide_init_port_hw(mate, &hw[1]); |
446 | mate->config_data = (base << 8) | config; | ||
447 | mate->port_init_devs = qd6580_port_init_devs; | ||
448 | mate->set_pio_mode = qd6580_set_pio_mode; | ||
449 | mate->selectproc = qd65xx_select; | ||
450 | idx[1] = mate->index; | 449 | idx[1] = mate->index; |
451 | } | 450 | } |
452 | 451 | ||
453 | ide_device_add(idx, &qd65xx_port_info); | 452 | ide_device_add(idx, &d); |
454 | 453 | ||
455 | return 0; /* no other qd65xx possible */ | 454 | return 0; /* no other qd65xx possible */ |
456 | } | 455 | } |