diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2009-04-08 08:13:03 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-04-08 08:13:03 -0400 |
commit | 3153c26b54230d025c6d536e8d3015def4524906 (patch) | |
tree | 0dc92136480ddfdd2f52a48045446e9ed95ed077 /drivers/ide/ide-io-std.c | |
parent | c9ff9e7b64138d87023b733e618f29a1d58543f7 (diff) |
ide: refactor tf_read() method
Simplify tf_read() method, making it deal only with 'struct ide_taskfile' and
the validity flags that the upper layer passes, and factoring out the code that
deals with the high order bytes into ide_tf_readback() to be called from the
only two functions interested, ide_complete_cmd() and ide_dump_sector().
This should stop the needless code duplication in this method and so make
it about twice smaller than it was; along with simplifying the setup for
the method call, this should save both time and space...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io-std.c')
-rw-r--r-- | drivers/ide/ide-io-std.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index 481e221b233d..46721c454518 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c | |||
@@ -112,13 +112,11 @@ void ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) | |||
112 | } | 112 | } |
113 | EXPORT_SYMBOL_GPL(ide_tf_load); | 113 | EXPORT_SYMBOL_GPL(ide_tf_load); |
114 | 114 | ||
115 | void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 115 | void ide_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) |
116 | { | 116 | { |
117 | ide_hwif_t *hwif = drive->hwif; | 117 | ide_hwif_t *hwif = drive->hwif; |
118 | struct ide_io_ports *io_ports = &hwif->io_ports; | 118 | struct ide_io_ports *io_ports = &hwif->io_ports; |
119 | struct ide_taskfile *tf = &cmd->tf; | ||
120 | u8 (*tf_inb)(unsigned long port); | 119 | u8 (*tf_inb)(unsigned long port); |
121 | u8 valid = cmd->valid.in.tf; | ||
122 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 120 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
123 | 121 | ||
124 | if (mmio) | 122 | if (mmio) |
@@ -126,9 +124,6 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
126 | else | 124 | else |
127 | tf_inb = ide_inb; | 125 | tf_inb = ide_inb; |
128 | 126 | ||
129 | /* be sure we're looking at the low order bits */ | ||
130 | hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS); | ||
131 | |||
132 | if (valid & IDE_VALID_ERROR) | 127 | if (valid & IDE_VALID_ERROR) |
133 | tf->error = tf_inb(io_ports->feature_addr); | 128 | tf->error = tf_inb(io_ports->feature_addr); |
134 | if (valid & IDE_VALID_NSECT) | 129 | if (valid & IDE_VALID_NSECT) |
@@ -141,24 +136,6 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
141 | tf->lbah = tf_inb(io_ports->lbah_addr); | 136 | tf->lbah = tf_inb(io_ports->lbah_addr); |
142 | if (valid & IDE_VALID_DEVICE) | 137 | if (valid & IDE_VALID_DEVICE) |
143 | tf->device = tf_inb(io_ports->device_addr); | 138 | tf->device = tf_inb(io_ports->device_addr); |
144 | |||
145 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
146 | hwif->tp_ops->write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS); | ||
147 | |||
148 | tf = &cmd->hob; | ||
149 | valid = cmd->valid.in.hob; | ||
150 | |||
151 | if (valid & IDE_VALID_ERROR) | ||
152 | tf->error = tf_inb(io_ports->feature_addr); | ||
153 | if (valid & IDE_VALID_NSECT) | ||
154 | tf->nsect = tf_inb(io_ports->nsect_addr); | ||
155 | if (valid & IDE_VALID_LBAL) | ||
156 | tf->lbal = tf_inb(io_ports->lbal_addr); | ||
157 | if (valid & IDE_VALID_LBAM) | ||
158 | tf->lbam = tf_inb(io_ports->lbam_addr); | ||
159 | if (valid & IDE_VALID_LBAH) | ||
160 | tf->lbah = tf_inb(io_ports->lbah_addr); | ||
161 | } | ||
162 | } | 139 | } |
163 | EXPORT_SYMBOL_GPL(ide_tf_read); | 140 | EXPORT_SYMBOL_GPL(ide_tf_read); |
164 | 141 | ||