aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:09 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:09 -0500
commit21d535c91362a1a3bbb299b2e7214c1a6971ef95 (patch)
tree0f9cd3b473caec8d926770ba565b2e8261c289bd /drivers/ide/ide-io.c
parent6dd87233bccc6416dac3b78ac912fd017918efe6 (diff)
ide: execute_drive_cmd() cleanup
* Rename 'args' variable in 'if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE)' block to 'task'. * execute_drive_cmd() is used only for REQ_TYPE_ATA_{CMD,TASK,TASKFILE} so we can move the common code out from 'if (rq->cmd_type == REQ_TYPE_ATA_CMD)' and 'if (rq->cmd_type == REQ_TYPE_ATA_TASK)' blocks. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c5d81df02007..98aafc5cc5ba 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -867,13 +867,15 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
867 struct request *rq) 867 struct request *rq)
868{ 868{
869 ide_hwif_t *hwif = HWIF(drive); 869 ide_hwif_t *hwif = HWIF(drive);
870 u8 *args = rq->buffer;
871
870 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 872 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
871 ide_task_t *args = rq->special; 873 ide_task_t *task = rq->special;
872 874
873 if (!args) 875 if (task == NULL)
874 goto done; 876 goto done;
875 877
876 hwif->data_phase = args->data_phase; 878 hwif->data_phase = task->data_phase;
877 879
878 switch (hwif->data_phase) { 880 switch (hwif->data_phase) {
879 case TASKFILE_MULTI_OUT: 881 case TASKFILE_MULTI_OUT:
@@ -886,19 +888,20 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
886 break; 888 break;
887 } 889 }
888 890
889 if (args->tf_flags & IDE_TFLAG_FLAGGED) 891 if (task->tf_flags & IDE_TFLAG_FLAGGED)
890 return flagged_taskfile(drive, args); 892 return flagged_taskfile(drive, task);
891 893
892 args->tf_flags |= IDE_TFLAG_OUT_TF; 894 task->tf_flags |= IDE_TFLAG_OUT_TF;
893 if (drive->addressing == 1) 895 if (drive->addressing == 1)
894 args->tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); 896 task->tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
895 897
896 return do_rw_taskfile(drive, args); 898 return do_rw_taskfile(drive, task);
897 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) { 899 }
898 u8 *args = rq->buffer; 900
899 901 if (args == NULL)
900 if (!args) 902 goto done;
901 goto done; 903
904 if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
902#ifdef DEBUG 905#ifdef DEBUG
903 printk("%s: DRIVE_TASK_CMD ", drive->name); 906 printk("%s: DRIVE_TASK_CMD ", drive->name);
904 printk("cmd=0x%02x ", args[0]); 907 printk("cmd=0x%02x ", args[0]);
@@ -915,13 +918,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
915 hwif->OUTB(args[4], IDE_LCYL_REG); 918 hwif->OUTB(args[4], IDE_LCYL_REG);
916 hwif->OUTB(args[5], IDE_HCYL_REG); 919 hwif->OUTB(args[5], IDE_HCYL_REG);
917 hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG); 920 hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG);
918 ide_cmd(drive, args[0], &drive_cmd_intr); 921 } else { /* rq->cmd_type == REQ_TYPE_ATA_CMD */
919 return ide_started;
920 } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
921 u8 *args = rq->buffer;
922
923 if (!args)
924 goto done;
925#ifdef DEBUG 922#ifdef DEBUG
926 printk("%s: DRIVE_CMD ", drive->name); 923 printk("%s: DRIVE_CMD ", drive->name);
927 printk("cmd=0x%02x ", args[0]); 924 printk("cmd=0x%02x ", args[0]);
@@ -937,10 +934,11 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
937 hwif->OUTB(0xc2, IDE_HCYL_REG); 934 hwif->OUTB(0xc2, IDE_HCYL_REG);
938 } else 935 } else
939 hwif->OUTB(args[1], IDE_NSECTOR_REG); 936 hwif->OUTB(args[1], IDE_NSECTOR_REG);
940 ide_cmd(drive, args[0], &drive_cmd_intr);
941 return ide_started;
942 } 937 }
943 938
939 ide_cmd(drive, args[0], &drive_cmd_intr);
940 return ide_started;
941
944done: 942done:
945 /* 943 /*
946 * NULL is actually a valid way of waiting for 944 * NULL is actually a valid way of waiting for