aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 2b4868d95f8..650981758f1 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -134,13 +134,17 @@ static ide_startstop_t ide_floppy_issue_pc(ide_drive_t *drive,
134 drive->pc = pc; 134 drive->pc = pc;
135 135
136 if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { 136 if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) {
137 unsigned int done = blk_rq_bytes(drive->hwif->rq);
138
137 if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) 139 if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR))
138 ide_floppy_report_error(floppy, pc); 140 ide_floppy_report_error(floppy, pc);
141
139 /* Giving up */ 142 /* Giving up */
140 pc->error = IDE_DRV_ERROR_GENERAL; 143 pc->error = IDE_DRV_ERROR_GENERAL;
141 144
142 drive->failed_pc = NULL; 145 drive->failed_pc = NULL;
143 drive->pc_callback(drive, 0); 146 drive->pc_callback(drive, 0);
147 ide_complete_rq(drive, -EIO, done);
144 return ide_stopped; 148 return ide_stopped;
145 } 149 }
146 150
@@ -190,7 +194,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive,
190{ 194{
191 struct ide_disk_obj *floppy = drive->driver_data; 195 struct ide_disk_obj *floppy = drive->driver_data;
192 int block = sector / floppy->bs_factor; 196 int block = sector / floppy->bs_factor;
193 int blocks = rq->nr_sectors / floppy->bs_factor; 197 int blocks = blk_rq_sectors(rq) / floppy->bs_factor;
194 int cmd = rq_data_dir(rq); 198 int cmd = rq_data_dir(rq);
195 199
196 ide_debug_log(IDE_DBG_FUNC, "block: %d, blocks: %d", block, blocks); 200 ide_debug_log(IDE_DBG_FUNC, "block: %d, blocks: %d", block, blocks);
@@ -216,16 +220,14 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy,
216 ide_init_pc(pc); 220 ide_init_pc(pc);
217 memcpy(pc->c, rq->cmd, sizeof(pc->c)); 221 memcpy(pc->c, rq->cmd, sizeof(pc->c));
218 pc->rq = rq; 222 pc->rq = rq;
219 if (rq->data_len && rq_data_dir(rq) == WRITE) 223 if (blk_rq_bytes(rq)) {
220 pc->flags |= PC_FLAG_WRITING;
221 pc->buf = rq->data;
222 if (rq->bio)
223 pc->flags |= PC_FLAG_DMA_OK; 224 pc->flags |= PC_FLAG_DMA_OK;
224 /* 225 if (rq_data_dir(rq) == WRITE)
225 * possibly problematic, doesn't look like ide-floppy correctly 226 pc->flags |= PC_FLAG_WRITING;
226 * handled scattered requests if dma fails... 227 }
227 */ 228 /* pio will be performed by ide_pio_bytes() which handles sg fine */
228 pc->req_xfer = pc->buf_size = rq->data_len; 229 pc->buf = NULL;
230 pc->req_xfer = pc->buf_size = blk_rq_bytes(rq);
229} 231}
230 232
231static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, 233static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
@@ -257,16 +259,16 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
257 goto out_end; 259 goto out_end;
258 } 260 }
259 if (blk_fs_request(rq)) { 261 if (blk_fs_request(rq)) {
260 if (((long)rq->sector % floppy->bs_factor) || 262 if (((long)blk_rq_pos(rq) % floppy->bs_factor) ||
261 (rq->nr_sectors % floppy->bs_factor)) { 263 (blk_rq_sectors(rq) % floppy->bs_factor)) {
262 printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", 264 printk(KERN_ERR PFX "%s: unsupported r/w rq size\n",
263 drive->name); 265 drive->name);
264 goto out_end; 266 goto out_end;
265 } 267 }
266 pc = &floppy->queued_pc; 268 pc = &floppy->queued_pc;
267 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); 269 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block);
268 } else if (blk_special_request(rq)) { 270 } else if (blk_special_request(rq) || blk_sense_request(rq)) {
269 pc = (struct ide_atapi_pc *) rq->buffer; 271 pc = (struct ide_atapi_pc *)rq->special;
270 } else if (blk_pc_request(rq)) { 272 } else if (blk_pc_request(rq)) {
271 pc = &floppy->queued_pc; 273 pc = &floppy->queued_pc;
272 idefloppy_blockpc_cmd(floppy, pc, rq); 274 idefloppy_blockpc_cmd(floppy, pc, rq);
@@ -275,6 +277,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
275 goto out_end; 277 goto out_end;
276 } 278 }
277 279
280 ide_prep_sense(drive, rq);
281
278 memset(&cmd, 0, sizeof(cmd)); 282 memset(&cmd, 0, sizeof(cmd));
279 283
280 if (rq_data_dir(rq)) 284 if (rq_data_dir(rq))