diff options
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 0873887194f7..e5fcb283702a 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -54,10 +54,9 @@ | |||
54 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
55 | #include <asm/io.h> | 55 | #include <asm/io.h> |
56 | 56 | ||
57 | static int __ide_end_request(ide_drive_t *drive, struct request *rq, | 57 | int ide_end_rq(ide_drive_t *drive, struct request *rq, int uptodate, |
58 | int uptodate, unsigned int nr_bytes, int dequeue) | 58 | unsigned int nr_bytes) |
59 | { | 59 | { |
60 | int ret = 1; | ||
61 | int error = 0; | 60 | int error = 0; |
62 | 61 | ||
63 | if (uptodate <= 0) | 62 | if (uptodate <= 0) |
@@ -83,14 +82,9 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, | |||
83 | ide_dma_on(drive); | 82 | ide_dma_on(drive); |
84 | } | 83 | } |
85 | 84 | ||
86 | if (!blk_end_request(rq, error, nr_bytes)) | 85 | return blk_end_request(rq, error, nr_bytes); |
87 | ret = 0; | ||
88 | |||
89 | if (ret == 0 && dequeue) | ||
90 | drive->hwif->rq = NULL; | ||
91 | |||
92 | return ret; | ||
93 | } | 86 | } |
87 | EXPORT_SYMBOL_GPL(ide_end_rq); | ||
94 | 88 | ||
95 | /** | 89 | /** |
96 | * ide_end_request - complete an IDE I/O | 90 | * ide_end_request - complete an IDE I/O |
@@ -107,6 +101,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
107 | { | 101 | { |
108 | unsigned int nr_bytes = nr_sectors << 9; | 102 | unsigned int nr_bytes = nr_sectors << 9; |
109 | struct request *rq = drive->hwif->rq; | 103 | struct request *rq = drive->hwif->rq; |
104 | int rc; | ||
110 | 105 | ||
111 | if (!nr_bytes) { | 106 | if (!nr_bytes) { |
112 | if (blk_pc_request(rq)) | 107 | if (blk_pc_request(rq)) |
@@ -115,33 +110,13 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | |||
115 | nr_bytes = rq->hard_cur_sectors << 9; | 110 | nr_bytes = rq->hard_cur_sectors << 9; |
116 | } | 111 | } |
117 | 112 | ||
118 | return __ide_end_request(drive, rq, uptodate, nr_bytes, 1); | 113 | rc = ide_end_rq(drive, rq, uptodate, nr_bytes); |
119 | } | 114 | if (rc == 0) |
120 | EXPORT_SYMBOL(ide_end_request); | 115 | drive->hwif->rq = NULL; |
121 | |||
122 | /** | ||
123 | * ide_end_dequeued_request - complete an IDE I/O | ||
124 | * @drive: IDE device for the I/O | ||
125 | * @uptodate: | ||
126 | * @nr_sectors: number of sectors completed | ||
127 | * | ||
128 | * Complete an I/O that is no longer on the request queue. This | ||
129 | * typically occurs when we pull the request and issue a REQUEST_SENSE. | ||
130 | * We must still finish the old request but we must not tamper with the | ||
131 | * queue in the meantime. | ||
132 | * | ||
133 | * NOTE: This path does not handle barrier, but barrier is not supported | ||
134 | * on ide-cd anyway. | ||
135 | */ | ||
136 | |||
137 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | ||
138 | int uptodate, int nr_sectors) | ||
139 | { | ||
140 | BUG_ON(!blk_rq_started(rq)); | ||
141 | 116 | ||
142 | return __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0); | 117 | return rc; |
143 | } | 118 | } |
144 | EXPORT_SYMBOL_GPL(ide_end_dequeued_request); | 119 | EXPORT_SYMBOL(ide_end_request); |
145 | 120 | ||
146 | void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | 121 | void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) |
147 | { | 122 | { |