aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-taskfile.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:31 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:31 -0400
commita09485df9cda49fbde2766c86eb18a9cae585162 (patch)
tree4dfc6219da40e86aa293621d43c5a71018c7992f /drivers/ide/ide-taskfile.c
parente120237c0e4d9a83c1380f5ff7b5f2ba31f1c820 (diff)
ide: move request type specific code from ide_end_drive_cmd() to callers (v3)
* Move request type specific code from ide_end_drive_cmd() to callers. * Remove stale ide_end_drive_cmd() documentation and drop no longer used 'stat' argument. Then rename the function to ide_complete_rq(). v2: * Fix handling of blk_pm_request() requests in task_no_data_intr(). v3: * Some ide_no_data_taskfile() users (HPA code and HDIO_DRIVE_* ioctls handlers) access original command later so we need to update it in ide_complete_task(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r--drivers/ide/ide-taskfile.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 02240a3ee0fb..297cf6f4c723 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -147,12 +147,9 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
147 } 147 }
148 } 148 }
149 return ide_error(drive, "task_no_data_intr", stat); 149 return ide_error(drive, "task_no_data_intr", stat);
150 /* calls ide_end_drive_cmd */
151 } 150 }
152 151
153 if (!custom) 152 if (custom && tf->command == ATA_CMD_IDLEIMMEDIATE) {
154 ide_end_drive_cmd(drive, stat, ide_read_error(drive));
155 else if (tf->command == ATA_CMD_IDLEIMMEDIATE) {
156 hwif->tp_ops->tf_read(drive, task); 153 hwif->tp_ops->tf_read(drive, task);
157 if (tf->lbal != 0xc4) { 154 if (tf->lbal != 0xc4) {
158 printk(KERN_ERR "%s: head unload failed!\n", 155 printk(KERN_ERR "%s: head unload failed!\n",
@@ -160,10 +157,22 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
160 ide_tf_dump(drive->name, tf); 157 ide_tf_dump(drive->name, tf);
161 } else 158 } else
162 drive->dev_flags |= IDE_DFLAG_PARKED; 159 drive->dev_flags |= IDE_DFLAG_PARKED;
163 ide_end_drive_cmd(drive, stat, ide_read_error(drive)); 160 } else if (custom && tf->command == ATA_CMD_SET_MULTI)
164 } else if (tf->command == ATA_CMD_SET_MULTI)
165 drive->mult_count = drive->mult_req; 161 drive->mult_count = drive->mult_req;
166 162
163 if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) {
164 struct request *rq = hwif->rq;
165 u8 err = ide_read_error(drive);
166
167 if (blk_pm_request(rq))
168 ide_complete_pm_rq(drive, rq);
169 else {
170 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
171 ide_complete_task(drive, task, stat, err);
172 ide_complete_rq(drive, err);
173 }
174 }
175
167 return ide_stopped; 176 return ide_stopped;
168} 177}
169 178
@@ -321,9 +330,12 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
321void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) 330void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
322{ 331{
323 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 332 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
333 ide_task_t *task = rq->special;
324 u8 err = ide_read_error(drive); 334 u8 err = ide_read_error(drive);
325 335
326 ide_end_drive_cmd(drive, stat, err); 336 if (task)
337 ide_complete_task(drive, task, stat, err);
338 ide_complete_rq(drive, err);
327 return; 339 return;
328 } 340 }
329 341