summaryrefslogtreecommitdiff
path: root/drivers/ide/ns87415.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-04-08 14:13:03 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-08 14:13:03 +0200
commit3153c26b54230d025c6d536e8d3015def4524906 (patch)
tree0dc92136480ddfdd2f52a48045446e9ed95ed077 /drivers/ide/ns87415.c
parentc9ff9e7b64138d87023b733e618f29a1d58543f7 (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/ns87415.c')
-rw-r--r--drivers/ide/ns87415.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c
index f1305f4d2be7..95327a2c2422 100644
--- a/drivers/ide/ns87415.c
+++ b/drivers/ide/ns87415.c
@@ -61,14 +61,10 @@ static u8 superio_dma_sff_read_status(ide_hwif_t *hwif)
return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
}
-static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
+static void superio_tf_read(ide_drive_t *drive, struct ide_taskfile *tf,
+ u8 valid)
{
struct ide_io_ports *io_ports = &drive->hwif->io_ports;
- struct ide_taskfile *tf = &cmd->tf;
- u8 valid = cmd->valid.in.tf;
-
- /* be sure we're looking at the low order bits */
- ide_write_devctl(hwif, ATA_DEVCTL_OBS);
if (valid & IDE_VALID_ERROR)
tf->error = inb(io_ports->feature_addr);
@@ -82,24 +78,6 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
tf->lbah = inb(io_ports->lbah_addr);
if (valid & IDE_VALID_DEVICE)
tf->device = superio_ide_inb(io_ports->device_addr);
-
- if (cmd->tf_flags & IDE_TFLAG_LBA48) {
- ide_write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS);
-
- tf = &cmd->hob;
- valid = cmd->valid.in.hob;
-
- if (valid & IDE_VALID_ERROR)
- tf->error = inb(io_ports->feature_addr);
- if (valid & IDE_VALID_NSECT)
- tf->nsect = inb(io_ports->nsect_addr);
- if (valid & IDE_VALID_LBAL)
- tf->lbal = inb(io_ports->lbal_addr);
- if (valid & IDE_VALID_LBAM)
- tf->lbam = inb(io_ports->lbam_addr);
- if (valid & IDE_VALID_LBAH)
- tf->lbah = inb(io_ports->lbah_addr);
- }
}
static void ns87415_dev_select(ide_drive_t *drive);