aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-iops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r--drivers/ide/ide-iops.c28
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);
159void SELECT_DRIVE (ide_drive_t *drive) 159void 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
169void SELECT_MASK (ide_drive_t *drive, int mask) 170void 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
975static void pre_reset(ide_drive_t *drive) 979static 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;