aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c38426de6041..4cc2bb13f1d6 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -144,17 +144,14 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
144 kfree(cmd); 144 kfree(cmd);
145} 145}
146 146
147void ide_complete_rq(ide_drive_t *drive, u8 err) 147void ide_complete_rq(ide_drive_t *drive, int error)
148{ 148{
149 ide_hwif_t *hwif = drive->hwif; 149 ide_hwif_t *hwif = drive->hwif;
150 struct request *rq = hwif->rq; 150 struct request *rq = hwif->rq;
151 151
152 hwif->rq = NULL; 152 hwif->rq = NULL;
153 153
154 rq->errors = err; 154 if (unlikely(blk_end_request(rq, error, blk_rq_bytes(rq))))
155
156 if (unlikely(blk_end_request(rq, (rq->errors ? -EIO : 0),
157 blk_rq_bytes(rq))))
158 BUG(); 155 BUG();
159} 156}
160EXPORT_SYMBOL(ide_complete_rq); 157EXPORT_SYMBOL(ide_complete_rq);
@@ -166,13 +163,14 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq)
166 163
167 drive->failed_pc = NULL; 164 drive->failed_pc = NULL;
168 165
169 if ((media == ide_floppy && drv_req) || media == ide_tape) 166 if ((media == ide_floppy || media == ide_tape) && drv_req) {
170 rq->errors = IDE_DRV_ERROR_GENERAL; 167 rq->errors = 0;
171
172 if ((media == ide_floppy || media == ide_tape) && drv_req)
173 ide_complete_rq(drive, 0); 168 ide_complete_rq(drive, 0);
174 else 169 } else {
170 if (media == ide_tape)
171 rq->errors = IDE_DRV_ERROR_GENERAL;
175 ide_end_request(drive, 0, 0); 172 ide_end_request(drive, 0, 0);
173 }
176} 174}
177 175
178static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) 176static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
@@ -312,6 +310,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
312#ifdef DEBUG 310#ifdef DEBUG
313 printk("%s: DRIVE_CMD (null)\n", drive->name); 311 printk("%s: DRIVE_CMD (null)\n", drive->name);
314#endif 312#endif
313 rq->errors = 0;
315 ide_complete_rq(drive, 0); 314 ide_complete_rq(drive, 0);
316 315
317 return ide_stopped; 316 return ide_stopped;