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-iops.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-iops.c')
-rw-r--r-- | drivers/ide/ide-iops.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 45944219eea0..bfec5d066b25 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -159,17 +159,20 @@ EXPORT_SYMBOL(default_hwif_mmiops); | |||
159 | void SELECT_DRIVE (ide_drive_t *drive) | 159 | void SELECT_DRIVE (ide_drive_t *drive) |
160 | { | 160 | { |
161 | ide_hwif_t *hwif = drive->hwif; | 161 | ide_hwif_t *hwif = drive->hwif; |
162 | const struct ide_port_ops *port_ops = hwif->port_ops; | ||
162 | 163 | ||
163 | if (hwif->selectproc) | 164 | if (port_ops && port_ops->selectproc) |
164 | hwif->selectproc(drive); | 165 | port_ops->selectproc(drive); |
165 | 166 | ||
166 | hwif->OUTB(drive->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); | 167 | hwif->OUTB(drive->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); |
167 | } | 168 | } |
168 | 169 | ||
169 | void SELECT_MASK (ide_drive_t *drive, int mask) | 170 | void SELECT_MASK (ide_drive_t *drive, int mask) |
170 | { | 171 | { |
171 | if (HWIF(drive)->maskproc) | 172 | const struct ide_port_ops *port_ops = drive->hwif->port_ops; |
172 | HWIF(drive)->maskproc(drive, mask); | 173 | |
174 | if (port_ops && port_ops->maskproc) | ||
175 | port_ops->maskproc(drive, mask); | ||
173 | } | 176 | } |
174 | 177 | ||
175 | /* | 178 | /* |
@@ -905,10 +908,11 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) | |||
905 | { | 908 | { |
906 | ide_hwgroup_t *hwgroup = HWGROUP(drive); | 909 | ide_hwgroup_t *hwgroup = HWGROUP(drive); |
907 | ide_hwif_t *hwif = HWIF(drive); | 910 | ide_hwif_t *hwif = HWIF(drive); |
911 | const struct ide_port_ops *port_ops = hwif->port_ops; | ||
908 | u8 tmp; | 912 | u8 tmp; |
909 | 913 | ||
910 | if (hwif->reset_poll != NULL) { | 914 | if (port_ops && port_ops->reset_poll) { |
911 | if (hwif->reset_poll(drive)) { | 915 | if (port_ops->reset_poll(drive)) { |
912 | printk(KERN_ERR "%s: host reset_poll failure for %s.\n", | 916 | printk(KERN_ERR "%s: host reset_poll failure for %s.\n", |
913 | hwif->name, drive->name); | 917 | hwif->name, drive->name); |
914 | return ide_stopped; | 918 | return ide_stopped; |
@@ -974,6 +978,8 @@ static void ide_disk_pre_reset(ide_drive_t *drive) | |||
974 | 978 | ||
975 | static void pre_reset(ide_drive_t *drive) | 979 | static void pre_reset(ide_drive_t *drive) |
976 | { | 980 | { |
981 | const struct ide_port_ops *port_ops = drive->hwif->port_ops; | ||
982 | |||
977 | if (drive->media == ide_disk) | 983 | if (drive->media == ide_disk) |
978 | ide_disk_pre_reset(drive); | 984 | ide_disk_pre_reset(drive); |
979 | else | 985 | else |
@@ -994,8 +1000,8 @@ static void pre_reset(ide_drive_t *drive) | |||
994 | return; | 1000 | return; |
995 | } | 1001 | } |
996 | 1002 | ||
997 | if (HWIF(drive)->pre_reset != NULL) | 1003 | if (port_ops && port_ops->pre_reset) |
998 | HWIF(drive)->pre_reset(drive); | 1004 | port_ops->pre_reset(drive); |
999 | 1005 | ||
1000 | if (drive->current_speed != 0xff) | 1006 | if (drive->current_speed != 0xff) |
1001 | drive->desired_speed = drive->current_speed; | 1007 | drive->desired_speed = drive->current_speed; |
@@ -1023,6 +1029,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1023 | unsigned long flags; | 1029 | unsigned long flags; |
1024 | ide_hwif_t *hwif; | 1030 | ide_hwif_t *hwif; |
1025 | ide_hwgroup_t *hwgroup; | 1031 | ide_hwgroup_t *hwgroup; |
1032 | const struct ide_port_ops *port_ops; | ||
1026 | u8 ctl; | 1033 | u8 ctl; |
1027 | 1034 | ||
1028 | spin_lock_irqsave(&ide_lock, flags); | 1035 | spin_lock_irqsave(&ide_lock, flags); |
@@ -1089,8 +1096,9 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1089 | * state when the disks are reset this way. At least, the Winbond | 1096 | * state when the disks are reset this way. At least, the Winbond |
1090 | * 553 documentation says that | 1097 | * 553 documentation says that |
1091 | */ | 1098 | */ |
1092 | if (hwif->resetproc) | 1099 | port_ops = hwif->port_ops; |
1093 | hwif->resetproc(drive); | 1100 | if (port_ops && port_ops->resetproc) |
1101 | port_ops->resetproc(drive); | ||
1094 | 1102 | ||
1095 | spin_unlock_irqrestore(&ide_lock, flags); | 1103 | spin_unlock_irqrestore(&ide_lock, flags); |
1096 | return ide_started; | 1104 | return ide_started; |