diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-io.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index d8b4d9f81ae2..c22a337ced4e 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -358,31 +358,6 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
358 | 358 | ||
359 | EXPORT_SYMBOL(ide_end_drive_cmd); | 359 | EXPORT_SYMBOL(ide_end_drive_cmd); |
360 | 360 | ||
361 | /** | ||
362 | * try_to_flush_leftover_data - flush junk | ||
363 | * @drive: drive to flush | ||
364 | * | ||
365 | * try_to_flush_leftover_data() is invoked in response to a drive | ||
366 | * unexpectedly having its DRQ_STAT bit set. As an alternative to | ||
367 | * resetting the drive, this routine tries to clear the condition | ||
368 | * by read a sector's worth of data from the drive. Of course, | ||
369 | * this may not help if the drive is *waiting* for data from *us*. | ||
370 | */ | ||
371 | static void try_to_flush_leftover_data (ide_drive_t *drive) | ||
372 | { | ||
373 | int i = (drive->mult_count ? drive->mult_count : 1) * SECTOR_WORDS; | ||
374 | |||
375 | if (drive->media != ide_disk) | ||
376 | return; | ||
377 | while (i > 0) { | ||
378 | u32 buffer[16]; | ||
379 | u32 wcount = (i > 16) ? 16 : i; | ||
380 | |||
381 | i -= wcount; | ||
382 | drive->hwif->input_data(drive, NULL, buffer, wcount * 4); | ||
383 | } | ||
384 | } | ||
385 | |||
386 | static void ide_kill_rq(ide_drive_t *drive, struct request *rq) | 361 | static void ide_kill_rq(ide_drive_t *drive, struct request *rq) |
387 | { | 362 | { |
388 | if (rq->rq_disk) { | 363 | if (rq->rq_disk) { |
@@ -422,8 +397,11 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
422 | } | 397 | } |
423 | 398 | ||
424 | if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && | 399 | if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && |
425 | (hwif->host_flags & IDE_HFLAG_ERROR_STOPS_FIFO) == 0) | 400 | (hwif->host_flags & IDE_HFLAG_ERROR_STOPS_FIFO) == 0) { |
426 | try_to_flush_leftover_data(drive); | 401 | int nsect = drive->mult_count ? drive->mult_count : 1; |
402 | |||
403 | ide_pad_transfer(drive, READ, nsect * SECTOR_SIZE); | ||
404 | } | ||
427 | 405 | ||
428 | if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) { | 406 | if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) { |
429 | ide_kill_rq(drive, rq); | 407 | ide_kill_rq(drive, rq); |