diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:31 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:31 -0400 |
commit | a09485df9cda49fbde2766c86eb18a9cae585162 (patch) | |
tree | 4dfc6219da40e86aa293621d43c5a71018c7992f /drivers/ide/ide-io.c | |
parent | e120237c0e4d9a83c1380f5ff7b5f2ba31f1c820 (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-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index b8426e9c0906..4a97a97e56c4 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -144,49 +144,28 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | |||
144 | } | 144 | } |
145 | EXPORT_SYMBOL_GPL(ide_end_dequeued_request); | 145 | EXPORT_SYMBOL_GPL(ide_end_dequeued_request); |
146 | 146 | ||
147 | static void ide_complete_task(ide_drive_t *drive, ide_task_t *task, | 147 | void ide_complete_task(ide_drive_t *drive, ide_task_t *task, u8 stat, u8 err) |
148 | u8 stat, u8 err) | ||
149 | { | 148 | { |
150 | struct ide_taskfile *tf = &task->tf; | 149 | struct ide_taskfile *tf = &task->tf; |
150 | struct request *rq = task->rq; | ||
151 | 151 | ||
152 | tf->error = err; | 152 | tf->error = err; |
153 | tf->status = stat; | 153 | tf->status = stat; |
154 | 154 | ||
155 | drive->hwif->tp_ops->tf_read(drive, task); | 155 | drive->hwif->tp_ops->tf_read(drive, task); |
156 | 156 | ||
157 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | ||
158 | memcpy(rq->special, task, sizeof(*task)); | ||
159 | |||
157 | if (task->tf_flags & IDE_TFLAG_DYN) | 160 | if (task->tf_flags & IDE_TFLAG_DYN) |
158 | kfree(task); | 161 | kfree(task); |
159 | } | 162 | } |
160 | 163 | ||
161 | /** | 164 | void ide_complete_rq(ide_drive_t *drive, u8 err) |
162 | * ide_end_drive_cmd - end an explicit drive command | ||
163 | * @drive: command | ||
164 | * @stat: status bits | ||
165 | * @err: error bits | ||
166 | * | ||
167 | * Clean up after success/failure of an explicit drive command. | ||
168 | * These get thrown onto the queue so they are synchronized with | ||
169 | * real I/O operations on the drive. | ||
170 | * | ||
171 | * In LBA48 mode we have to read the register set twice to get | ||
172 | * all the extra information out. | ||
173 | */ | ||
174 | |||
175 | void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | ||
176 | { | 165 | { |
177 | ide_hwif_t *hwif = drive->hwif; | 166 | ide_hwif_t *hwif = drive->hwif; |
178 | struct request *rq = hwif->rq; | 167 | struct request *rq = hwif->rq; |
179 | 168 | ||
180 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | ||
181 | ide_task_t *task = (ide_task_t *)rq->special; | ||
182 | |||
183 | if (task) | ||
184 | ide_complete_task(drive, task, stat, err); | ||
185 | } else if (blk_pm_request(rq)) { | ||
186 | ide_complete_pm_rq(drive, rq); | ||
187 | return; | ||
188 | } | ||
189 | |||
190 | hwif->rq = NULL; | 169 | hwif->rq = NULL; |
191 | 170 | ||
192 | rq->errors = err; | 171 | rq->errors = err; |
@@ -195,7 +174,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
195 | blk_rq_bytes(rq)))) | 174 | blk_rq_bytes(rq)))) |
196 | BUG(); | 175 | BUG(); |
197 | } | 176 | } |
198 | EXPORT_SYMBOL(ide_end_drive_cmd); | 177 | EXPORT_SYMBOL(ide_complete_rq); |
199 | 178 | ||
200 | void ide_kill_rq(ide_drive_t *drive, struct request *rq) | 179 | void ide_kill_rq(ide_drive_t *drive, struct request *rq) |
201 | { | 180 | { |
@@ -358,8 +337,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
358 | #ifdef DEBUG | 337 | #ifdef DEBUG |
359 | printk("%s: DRIVE_CMD (null)\n", drive->name); | 338 | printk("%s: DRIVE_CMD (null)\n", drive->name); |
360 | #endif | 339 | #endif |
361 | ide_end_drive_cmd(drive, hwif->tp_ops->read_status(hwif), | 340 | (void)hwif->tp_ops->read_status(hwif); |
362 | ide_read_error(drive)); | 341 | |
342 | ide_complete_rq(drive, ide_read_error(drive)); | ||
363 | 343 | ||
364 | return ide_stopped; | 344 | return ide_stopped; |
365 | } | 345 | } |