From e7fedc3ca0b8fcd3350a40c42a7100a9539e6c4a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:41 +0100 Subject: 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 --- drivers/ide/ide-io.c | 11 +++++++++++ drivers/ide/ide-taskfile.c | 13 +++---------- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'drivers/ide') 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) { struct ide_taskfile *tf = &cmd->tf; struct request *rq = cmd->rq; + u8 tf_cmd = tf->command; tf->error = err; tf->status = stat; drive->hwif->tp_ops->tf_read(drive, cmd); + if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && + tf_cmd == ATA_CMD_IDLEIMMEDIATE) { + if (tf->lbal != 0xc4) { + printk(KERN_ERR "%s: head unload failed!\n", + drive->name); + ide_tf_dump(drive->name, tf); + } else + drive->dev_flags |= IDE_DFLAG_PARKED; + } + if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) memcpy(rq->special, cmd, sizeof(*cmd)); 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) return ide_error(drive, "task_no_data_intr", stat); } - if (custom && tf->command == ATA_CMD_IDLEIMMEDIATE) { - hwif->tp_ops->tf_read(drive, cmd); - if (tf->lbal != 0xc4) { - printk(KERN_ERR "%s: head unload failed!\n", - drive->name); - ide_tf_dump(drive->name, tf); - } else - drive->dev_flags |= IDE_DFLAG_PARKED; - } else if (custom && tf->command == ATA_CMD_SET_MULTI) + if (custom && tf->command == ATA_CMD_SET_MULTI) drive->mult_count = drive->mult_req; if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) { @@ -164,7 +156,8 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) if (blk_pm_request(rq)) ide_complete_pm_rq(drive, rq); else { - if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) + if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE || + tf->command == ATA_CMD_IDLEIMMEDIATE) ide_complete_cmd(drive, cmd, stat, err); ide_complete_rq(drive, err); } -- cgit v1.2.1