aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r--drivers/block/floppy.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 639ed14bb08d..32c79a55511b 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2287,21 +2287,19 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
2287 * ============================= 2287 * =============================
2288 */ 2288 */
2289 2289
2290static void floppy_end_request(struct request *req, int uptodate) 2290static void floppy_end_request(struct request *req, int error)
2291{ 2291{
2292 unsigned int nr_sectors = current_count_sectors; 2292 unsigned int nr_sectors = current_count_sectors;
2293 unsigned int drive = (unsigned long)req->rq_disk->private_data;
2293 2294
2294 /* current_count_sectors can be zero if transfer failed */ 2295 /* current_count_sectors can be zero if transfer failed */
2295 if (!uptodate) 2296 if (error)
2296 nr_sectors = req->current_nr_sectors; 2297 nr_sectors = req->current_nr_sectors;
2297 if (end_that_request_first(req, uptodate, nr_sectors)) 2298 if (__blk_end_request(req, error, nr_sectors << 9))
2298 return; 2299 return;
2299 add_disk_randomness(req->rq_disk);
2300 floppy_off((long)req->rq_disk->private_data);
2301 blkdev_dequeue_request(req);
2302 end_that_request_last(req, uptodate);
2303 2300
2304 /* We're done with the request */ 2301 /* We're done with the request */
2302 floppy_off(drive);
2305 current_req = NULL; 2303 current_req = NULL;
2306} 2304}
2307 2305
@@ -2332,7 +2330,7 @@ static void request_done(int uptodate)
2332 2330
2333 /* unlock chained buffers */ 2331 /* unlock chained buffers */
2334 spin_lock_irqsave(q->queue_lock, flags); 2332 spin_lock_irqsave(q->queue_lock, flags);
2335 floppy_end_request(req, 1); 2333 floppy_end_request(req, 0);
2336 spin_unlock_irqrestore(q->queue_lock, flags); 2334 spin_unlock_irqrestore(q->queue_lock, flags);
2337 } else { 2335 } else {
2338 if (rq_data_dir(req) == WRITE) { 2336 if (rq_data_dir(req) == WRITE) {
@@ -2346,7 +2344,7 @@ static void request_done(int uptodate)
2346 DRWE->last_error_generation = DRS->generation; 2344 DRWE->last_error_generation = DRS->generation;
2347 } 2345 }
2348 spin_lock_irqsave(q->queue_lock, flags); 2346 spin_lock_irqsave(q->queue_lock, flags);
2349 floppy_end_request(req, 0); 2347 floppy_end_request(req, -EIO);
2350 spin_unlock_irqrestore(q->queue_lock, flags); 2348 spin_unlock_irqrestore(q->queue_lock, flags);
2351 } 2349 }
2352} 2350}