ide: move data register access out of tf_{read|load}() methods (take 2)
authorSergei Shtylyov <sshtylyov@ru.mvista.com>
Tue, 31 Mar 2009 18:15:31 +0000 (20:15 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 31 Mar 2009 18:15:31 +0000 (20:15 +0200)
Move IDE_FTFLAG_{IN|OUT}_DATA flag handling out of tf_{read|load}() methods
into the only two functions where these flags actually need to be handled:
do_rw_taskfile() and ide_complete_cmd()...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/at91_ide.c
drivers/ide/ide-h8300.c
drivers/ide/ide-io-std.c
drivers/ide/ide-io.c
drivers/ide/ide-taskfile.c
drivers/ide/ns87415.c
drivers/ide/scc_pata.c
drivers/ide/tx4938ide.c
drivers/ide/tx4939ide.c

index b7be66d600f82adc50e774b88fc1d4d308eed296..04b39ff02d765863f2f9e403974d86b6753f7ec6 100644 (file)
@@ -195,12 +195,6 @@ static void at91_ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
        if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
                HIHI = 0xFF;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
-               u8 data[2] = { tf->data, tf->hob_data };
-
-               at91_ide_output_data(drive, cmd, data, 2);
-       }
-
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
                ide_mm_outb(tf->hob_feature, io_ports->feature_addr);
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -233,15 +227,6 @@ static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
        struct ide_io_ports *io_ports = &hwif->io_ports;
        struct ide_taskfile *tf = &cmd->tf;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u8 data[2];
-
-               at91_ide_input_data(drive, cmd, data, 2);
-
-               tf->data = data[0];
-               tf->hob_data = data[1];
-       }
-
        /* be sure we're looking at the low order bits */
        ide_mm_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
 
index 6cb1785d32e6ab419dd8c438ec6776996068f591..8541a9abd7ac749b97fe253947c94fa224b0eb85 100644 (file)
@@ -54,12 +54,6 @@ static void h8300_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
        if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
                HIHI = 0xFF;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
-               u8 data[2] = { tf->data, tf->hob_data };
-
-               h8300_output_data(drive, cmd, data, 2);
-       }
-
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
                outb(tf->hob_feature, io_ports->feature_addr);
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -93,15 +87,6 @@ static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
        struct ide_io_ports *io_ports = &hwif->io_ports;
        struct ide_taskfile *tf = &cmd->tf;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u8 data[2];
-
-               h8300_input_data(drive, cmd, data, 2);
-
-               tf->data = data[0];
-               tf->hob_data = data[1];
-       }
-
        /* be sure we're looking at the low order bits */
        outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
 
index f06940df255e9ce9cbb1b0cdef1388f63b9eae87..7f77bb7db48857263c8040b7b19e6cf31c5261d8 100644 (file)
@@ -90,12 +90,6 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
        if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
                HIHI = 0xFF;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
-               u8 data[2] = { tf->data, tf->hob_data };
-
-               ide_output_data(drive, cmd, data, 2);
-       }
-
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
                tf_outb(tf->hob_feature, io_ports->feature_addr);
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -141,15 +135,6 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
                tf_inb  = ide_inb;
        }
 
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u8 data[2];
-
-               ide_input_data(drive, cmd, data, 2);
-
-               tf->data = data[0];
-               tf->hob_data = data[1];
-       }
-
        /* be sure we're looking at the low order bits */
        tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
 
index 5b57905a7d713e5174980d38ee642bd6758a837c..5589dce886745e966e5765f71f4d983d8671465e 100644 (file)
@@ -73,6 +73,7 @@ EXPORT_SYMBOL_GPL(ide_end_rq);
 
 void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
 {
+       const struct ide_tp_ops *tp_ops = drive->hwif->tp_ops;
        struct ide_taskfile *tf = &cmd->tf;
        struct request *rq = cmd->rq;
        u8 tf_cmd = tf->command;
@@ -80,7 +81,16 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
        tf->error = err;
        tf->status = stat;
 
-       drive->hwif->tp_ops->tf_read(drive, cmd);
+       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
+               u8 data[2];
+
+               tp_ops->input_data(drive, cmd, data, 2);
+
+               tf->data = data[0];
+               tf->hob_data = data[1];
+       }
+
+       tp_ops->tf_read(drive, cmd);
 
        if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) &&
            tf_cmd == ATA_CMD_IDLEIMMEDIATE) {
index 47f13cd11031a36dfec07a84e05836437d475319..243421ce40d02ccee63b211f202017782e4d8262 100644 (file)
@@ -82,6 +82,12 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
                ide_tf_dump(drive->name, tf);
                tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
                SELECT_MASK(drive, 0);
+
+               if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
+                       u8 data[2] = { tf->data, tf->hob_data };
+
+                       tp_ops->output_data(drive, cmd, data, 2);
+               }
                tp_ops->tf_load(drive, cmd);
        }
 
index 7d64bc079fa83bebb5a406ae0e39c3b4e4d5f1d0..9f6dff83b141cf22758a05c4b1c603dd0153cb4c 100644 (file)
@@ -66,15 +66,6 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
        struct ide_io_ports *io_ports = &drive->hwif->io_ports;
        struct ide_taskfile *tf = &cmd->tf;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u8 data[2];
-
-               ide_input_data(drive, cmd, data, 2);
-
-               tf->data = data[0];
-               tf->hob_data = data[1];
-       }
-
        /* be sure we're looking at the low order bits */
        outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
 
index 9c47cbf8c506df4c7979c57ab15879dbf5ac862f..97f8e0ef21b16e0851ba45f4375015889118e810 100644 (file)
@@ -656,12 +656,6 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
        if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
                HIHI = 0xFF;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
-               u8 data[2] = { tf->data, tf->hob_data };
-
-               scc_output_data(drive, NULL, data, 2);
-       }
-
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
                scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -694,15 +688,6 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
        struct ide_io_ports *io_ports = &drive->hwif->io_ports;
        struct ide_taskfile *tf = &cmd->tf;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u8 data[2];
-
-               scc_input_data(drive, cmd, data, 2);
-
-               tf->data = data[0];
-               tf->hob_data = data[1];
-       }
-
        /* be sure we're looking at the low order bits */
        scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
 
index c075464308a0f6e53ccdf00dbbf8938f860c0cf3..be391b615963398c33e5cdb4f52a6145f68f0c1b 100644 (file)
@@ -92,12 +92,6 @@ static void tx4938ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
        if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
                HIHI = 0xFF;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
-               u8 data[2] = { tf->data, tf->hob_data };
-
-               hwif->tp_ops->output_data(drive, cmd, data, 2);
-       }
-
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
                tx4938ide_outb(tf->hob_feature, io_ports->feature_addr);
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -131,15 +125,6 @@ static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
        struct ide_io_ports *io_ports = &hwif->io_ports;
        struct ide_taskfile *tf = &cmd->tf;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u8 data[2];
-
-               hwif->tp_ops->input_data(drive, cmd, data, 2);
-
-               tf->data = data[0];
-               tf->hob_data = data[1];
-       }
-
        /* be sure we're looking at the low order bits */
        tx4938ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
 
index c350d0c7ba4a384e543fbaa99399ef84e4fac1ac..5a614d1c94f15b2160eb6e491037a4f2a3911982 100644 (file)
@@ -457,12 +457,6 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
        if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
                HIHI = 0xFF;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
-               u8 data[2] = { tf->data, tf->hob_data };
-
-               hwif->tp_ops->output_data(drive, cmd, data, 2);
-       }
-
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
                tx4939ide_outb(tf->hob_feature, io_ports->feature_addr);
        if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -498,15 +492,6 @@ static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
        struct ide_io_ports *io_ports = &hwif->io_ports;
        struct ide_taskfile *tf = &cmd->tf;
 
-       if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
-               u8 data[2];
-
-               hwif->tp_ops->input_data(drive, cmd, data, 2);
-
-               tf->data = data[0];
-               tf->hob_data = data[1];
-       }
-
        /* be sure we're looking at the low order bits */
        tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);