aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:43 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:43 -0400
commit37245aabfa0c628ba884cd88fe5cd633b426a1b2 (patch)
treea1513de9d27f0b7f2fb801807fa06b7fa4232981 /drivers/ide
parent1caf236dafb7291f9fdfe54b12dd945aec0dca03 (diff)
ide: sanitize ide_end_rq()
* Move 'uptodate' quirk from ide_end_rq() to its users. * Move quirks for blk_noretry_request() and !blk_fs_request() requests from ide_end_rq() to ide_end_request(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c2
-rw-r--r--drivers/ide/ide-io.c34
2 files changed, 17 insertions, 19 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 830fd570e76..bbbebcbb1e3 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -272,7 +272,7 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate)
272 * now end the failed request 272 * now end the failed request
273 */ 273 */
274 if (blk_fs_request(failed)) { 274 if (blk_fs_request(failed)) {
275 if (ide_end_rq(drive, failed, 0, 275 if (ide_end_rq(drive, failed, -EIO,
276 failed->hard_nr_sectors << 9)) 276 failed->hard_nr_sectors << 9))
277 BUG(); 277 BUG();
278 } else { 278 } else {
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index e5fcb283702..c38426de604 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -54,24 +54,9 @@
54#include <asm/uaccess.h> 54#include <asm/uaccess.h>
55#include <asm/io.h> 55#include <asm/io.h>
56 56
57int ide_end_rq(ide_drive_t *drive, struct request *rq, int uptodate, 57int ide_end_rq(ide_drive_t *drive, struct request *rq, int error,
58 unsigned int nr_bytes) 58 unsigned int nr_bytes)
59{ 59{
60 int error = 0;
61
62 if (uptodate <= 0)
63 error = uptodate ? uptodate : -EIO;
64
65 /*
66 * if failfast is set on a request, override number of sectors and
67 * complete the whole request right now
68 */
69 if (blk_noretry_request(rq) && error)
70 nr_bytes = rq->hard_nr_sectors << 9;
71
72 if (!blk_fs_request(rq) && error && !rq->errors)
73 rq->errors = -EIO;
74
75 /* 60 /*
76 * decide whether to reenable DMA -- 3 is a random magic for now, 61 * decide whether to reenable DMA -- 3 is a random magic for now,
77 * if we DMA timeout more than 3 times, just stay in PIO 62 * if we DMA timeout more than 3 times, just stay in PIO
@@ -101,7 +86,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
101{ 86{
102 unsigned int nr_bytes = nr_sectors << 9; 87 unsigned int nr_bytes = nr_sectors << 9;
103 struct request *rq = drive->hwif->rq; 88 struct request *rq = drive->hwif->rq;
104 int rc; 89 int rc, error = 0;
105 90
106 if (!nr_bytes) { 91 if (!nr_bytes) {
107 if (blk_pc_request(rq)) 92 if (blk_pc_request(rq))
@@ -110,7 +95,20 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
110 nr_bytes = rq->hard_cur_sectors << 9; 95 nr_bytes = rq->hard_cur_sectors << 9;
111 } 96 }
112 97
113 rc = ide_end_rq(drive, rq, uptodate, nr_bytes); 98 /*
99 * if failfast is set on a request, override number of sectors
100 * and complete the whole request right now
101 */
102 if (blk_noretry_request(rq) && uptodate <= 0)
103 nr_bytes = rq->hard_nr_sectors << 9;
104
105 if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0)
106 rq->errors = -EIO;
107
108 if (uptodate <= 0)
109 error = uptodate ? uptodate : -EIO;
110
111 rc = ide_end_rq(drive, rq, error, nr_bytes);
114 if (rc == 0) 112 if (rc == 0)
115 drive->hwif->rq = NULL; 113 drive->hwif->rq = NULL;
116 114