diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:41 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:41 -0400 |
commit | e7fedc3ca0b8fcd3350a40c42a7100a9539e6c4a (patch) | |
tree | 84cd0b58c1c37a4f14f769555ea877b0f4e44efa /drivers/ide | |
parent | 041cea10a86a25b088185d07ad15d728f503f02c (diff) |
ide: use ide_complete_cmd() for head unload commands
Move handling of head unload commands from task_no_data_intr()
to ide_complete_cmd() and then use ide_complete_cmd() also for
head unload commands.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-io.c | 11 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 13 |
2 files changed, 14 insertions, 10 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c27eaab1ffcf..c33a8006838b 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -147,12 +147,23 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | |||
147 | { | 147 | { |
148 | struct ide_taskfile *tf = &cmd->tf; | 148 | struct ide_taskfile *tf = &cmd->tf; |
149 | struct request *rq = cmd->rq; | 149 | struct request *rq = cmd->rq; |
150 | u8 tf_cmd = tf->command; | ||
150 | 151 | ||
151 | tf->error = err; | 152 | tf->error = err; |
152 | tf->status = stat; | 153 | tf->status = stat; |
153 | 154 | ||
154 | drive->hwif->tp_ops->tf_read(drive, cmd); | 155 | drive->hwif->tp_ops->tf_read(drive, cmd); |
155 | 156 | ||
157 | if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && | ||
158 | tf_cmd == ATA_CMD_IDLEIMMEDIATE) { | ||
159 | if (tf->lbal != 0xc4) { | ||
160 | printk(KERN_ERR "%s: head unload failed!\n", | ||
161 | drive->name); | ||
162 | ide_tf_dump(drive->name, tf); | ||
163 | } else | ||
164 | drive->dev_flags |= IDE_DFLAG_PARKED; | ||
165 | } | ||
166 | |||
156 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 167 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
157 | memcpy(rq->special, cmd, sizeof(*cmd)); | 168 | memcpy(rq->special, cmd, sizeof(*cmd)); |
158 | 169 | ||
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index c02687507682..4883aa4052ac 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -146,15 +146,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) | |||
146 | return ide_error(drive, "task_no_data_intr", stat); | 146 | return ide_error(drive, "task_no_data_intr", stat); |
147 | } | 147 | } |
148 | 148 | ||
149 | if (custom && tf->command == ATA_CMD_IDLEIMMEDIATE) { | 149 | if (custom && tf->command == ATA_CMD_SET_MULTI) |
150 | hwif->tp_ops->tf_read(drive, cmd); | ||
151 | if (tf->lbal != 0xc4) { | ||
152 | printk(KERN_ERR "%s: head unload failed!\n", | ||
153 | drive->name); | ||
154 | ide_tf_dump(drive->name, tf); | ||
155 | } else | ||
156 | drive->dev_flags |= IDE_DFLAG_PARKED; | ||
157 | } else if (custom && tf->command == ATA_CMD_SET_MULTI) | ||
158 | drive->mult_count = drive->mult_req; | 150 | drive->mult_count = drive->mult_req; |
159 | 151 | ||
160 | if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) { | 152 | if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) { |
@@ -164,7 +156,8 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) | |||
164 | if (blk_pm_request(rq)) | 156 | if (blk_pm_request(rq)) |
165 | ide_complete_pm_rq(drive, rq); | 157 | ide_complete_pm_rq(drive, rq); |
166 | else { | 158 | else { |
167 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 159 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE || |
160 | tf->command == ATA_CMD_IDLEIMMEDIATE) | ||
168 | ide_complete_cmd(drive, cmd, stat, err); | 161 | ide_complete_cmd(drive, cmd, stat, err); |
169 | ide_complete_rq(drive, err); | 162 | ide_complete_rq(drive, err); |
170 | } | 163 | } |