diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 22:25:14 +0200 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 22:25:14 +0200 |
commit | ac95beedf8bc97b24f9540d4da9952f07221c023 (patch) | |
tree | c29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/legacy/qd65xx.c | |
parent | 4a27214d7be31e122db4102166f49ec15958e8e9 (diff) | |
download | op-kernel-dev-ac95beedf8bc97b24f9540d4da9952f07221c023.zip op-kernel-dev-ac95beedf8bc97b24f9540d4da9952f07221c023.tar.gz |
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 6e820c7..65f098d 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) hwif->drives[1].drive_data = t2; } +static const struct ide_port_ops qd6500_port_ops = { + .port_init_devs = qd6500_port_init_devs, + .set_pio_mode = qd6500_set_pio_mode, + .selectproc = qd65xx_select, +}; + +static const struct ide_port_ops qd6580_port_ops = { + .port_init_devs = qd6580_port_init_devs, + .set_pio_mode = qd6580_set_pio_mode, + .selectproc = qd65xx_select, +}; + static const struct ide_port_info qd65xx_port_info __initdata = { .chipset = ide_qd65xx, .host_flags = IDE_HFLAG_IO_32BIT | @@ -361,6 +373,7 @@ static int __init qd_probe(int base) printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n", config, QD_ID3); + d.port_ops = &qd6500_port_ops; d.host_flags |= IDE_HFLAG_SINGLE; hwif = ide_find_port_slot(&d); @@ -371,10 +384,6 @@ static int __init qd_probe(int base) hwif->config_data = (base << 8) | config; - hwif->port_init_devs = qd6500_port_init_devs; - hwif->set_pio_mode = qd6500_set_pio_mode; - hwif->selectproc = qd65xx_select; - idx[unit] = hwif->index; ide_device_add(idx, &d); @@ -400,6 +409,8 @@ static int __init qd_probe(int base) outb(QD_DEF_CONTR, QD_CONTROL_PORT); + d.port_ops = &qd6580_port_ops; + if (control & QD_CONTR_SEC_DISABLED) { /* secondary disabled */ @@ -415,10 +426,6 @@ static int __init qd_probe(int base) hwif->config_data = (base << 8) | config; - hwif->port_init_devs = qd6580_port_init_devs; - hwif->set_pio_mode = qd6580_set_pio_mode; - hwif->selectproc = qd65xx_select; - idx[unit] = hwif->index; ide_device_add(idx, &d); @@ -433,24 +440,16 @@ static int __init qd_probe(int base) hwif = ide_find_port(); if (hwif) { ide_init_port_hw(hwif, &hw[0]); - hwif->config_data = (base << 8) | config; - hwif->port_init_devs = qd6580_port_init_devs; - hwif->set_pio_mode = qd6580_set_pio_mode; - hwif->selectproc = qd65xx_select; idx[0] = hwif->index; } mate = ide_find_port(); if (mate) { ide_init_port_hw(mate, &hw[1]); - mate->config_data = (base << 8) | config; - mate->port_init_devs = qd6580_port_init_devs; - mate->set_pio_mode = qd6580_set_pio_mode; - mate->selectproc = qd65xx_select; idx[1] = mate->index; } - ide_device_add(idx, &qd65xx_port_info); + ide_device_add(idx, &d); return 0; /* no other qd65xx possible */ } |