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/ide-probe.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/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 875429728021..dfe516fdd079 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -821,13 +821,14 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
821 | 821 | ||
822 | static void ide_port_tune_devices(ide_hwif_t *hwif) | 822 | static void ide_port_tune_devices(ide_hwif_t *hwif) |
823 | { | 823 | { |
824 | const struct ide_port_ops *port_ops = hwif->port_ops; | ||
824 | int unit; | 825 | int unit; |
825 | 826 | ||
826 | for (unit = 0; unit < MAX_DRIVES; unit++) { | 827 | for (unit = 0; unit < MAX_DRIVES; unit++) { |
827 | ide_drive_t *drive = &hwif->drives[unit]; | 828 | ide_drive_t *drive = &hwif->drives[unit]; |
828 | 829 | ||
829 | if (drive->present && hwif->quirkproc) | 830 | if (drive->present && port_ops && port_ops->quirkproc) |
830 | hwif->quirkproc(drive); | 831 | port_ops->quirkproc(drive); |
831 | } | 832 | } |
832 | 833 | ||
833 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 834 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
@@ -1324,6 +1325,7 @@ static void hwif_register_devices(ide_hwif_t *hwif) | |||
1324 | 1325 | ||
1325 | static void ide_port_init_devices(ide_hwif_t *hwif) | 1326 | static void ide_port_init_devices(ide_hwif_t *hwif) |
1326 | { | 1327 | { |
1328 | const struct ide_port_ops *port_ops = hwif->port_ops; | ||
1327 | int i; | 1329 | int i; |
1328 | 1330 | ||
1329 | for (i = 0; i < MAX_DRIVES; i++) { | 1331 | for (i = 0; i < MAX_DRIVES; i++) { |
@@ -1339,8 +1341,8 @@ static void ide_port_init_devices(ide_hwif_t *hwif) | |||
1339 | drive->autotune = 1; | 1341 | drive->autotune = 1; |
1340 | } | 1342 | } |
1341 | 1343 | ||
1342 | if (hwif->port_init_devs) | 1344 | if (port_ops && port_ops->port_init_devs) |
1343 | hwif->port_init_devs(hwif); | 1345 | port_ops->port_init_devs(hwif); |
1344 | } | 1346 | } |
1345 | 1347 | ||
1346 | static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | 1348 | static void ide_init_port(ide_hwif_t *hwif, unsigned int port, |
@@ -1365,6 +1367,10 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1365 | hwif->host_flags = d->host_flags; | 1367 | hwif->host_flags = d->host_flags; |
1366 | hwif->pio_mask = d->pio_mask; | 1368 | hwif->pio_mask = d->pio_mask; |
1367 | 1369 | ||
1370 | /* ->set_pio_mode for DTC2278 is currently limited to port 0 */ | ||
1371 | if (hwif->chipset != ide_dtc2278 || hwif->channel == 0) | ||
1372 | hwif->port_ops = d->port_ops; | ||
1373 | |||
1368 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) | 1374 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) |
1369 | hwif->mate->serialized = hwif->serialized = 1; | 1375 | hwif->mate->serialized = hwif->serialized = 1; |
1370 | 1376 | ||
@@ -1386,9 +1392,11 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1386 | 1392 | ||
1387 | static void ide_port_cable_detect(ide_hwif_t *hwif) | 1393 | static void ide_port_cable_detect(ide_hwif_t *hwif) |
1388 | { | 1394 | { |
1389 | if (hwif->cable_detect && (hwif->ultra_mask & 0x78)) { | 1395 | const struct ide_port_ops *port_ops = hwif->port_ops; |
1396 | |||
1397 | if (port_ops && port_ops->cable_detect && (hwif->ultra_mask & 0x78)) { | ||
1390 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 1398 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |
1391 | hwif->cbl = hwif->cable_detect(hwif); | 1399 | hwif->cbl = port_ops->cable_detect(hwif); |
1392 | } | 1400 | } |
1393 | } | 1401 | } |
1394 | 1402 | ||