aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:34 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:34 -0400
commitc152cc1a90f9680cefa74d9ff9ce36038081ba72 (patch)
tree7932faaf671d8ac20d61a2df2cfe43c7919b0d4f /drivers
parent5e2040fd0a97888952b37243b5868872bbe0f6ac (diff)
ide: use ->end_request only for private device driver requests
* Move IDE{FLOPPY,TAPE}_ERROR_* defines to <linux/ide.h> and rename them to IDE_DRV_ERROR_*. * Handle ->end_request special cases for floppy/tape media in ide_kill_rq(). * Call ->end_request only for private device driver requests. There should be no functional changes caused by this patch. Acked-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-floppy.c7
-rw-r--r--drivers/ide/ide-io.c7
-rw-r--r--drivers/ide/ide-tape.c19
-rw-r--r--drivers/ide/ide-taskfile.c16
4 files changed, 18 insertions, 31 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index f9ad4b3021ee..fb235641da33 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -61,9 +61,6 @@
61 */ 61 */
62#define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */ 62#define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */
63 63
64/* Error code returned in rq->errors to the higher part of the driver. */
65#define IDEFLOPPY_ERROR_GENERAL 101
66
67/* 64/*
68 * Used to finish servicing a request. For read/write requests, we will call 65 * Used to finish servicing a request. For read/write requests, we will call
69 * ide_end_request to pass to the next buffer. 66 * ide_end_request to pass to the next buffer.
@@ -77,7 +74,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
77 74
78 switch (uptodate) { 75 switch (uptodate) {
79 case 0: 76 case 0:
80 error = IDEFLOPPY_ERROR_GENERAL; 77 error = IDE_DRV_ERROR_GENERAL;
81 break; 78 break;
82 79
83 case 1: 80 case 1:
@@ -183,7 +180,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
183 if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) 180 if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR))
184 ide_floppy_report_error(floppy, pc); 181 ide_floppy_report_error(floppy, pc);
185 /* Giving up */ 182 /* Giving up */
186 pc->error = IDEFLOPPY_ERROR_GENERAL; 183 pc->error = IDE_DRV_ERROR_GENERAL;
187 184
188 drive->failed_pc = NULL; 185 drive->failed_pc = NULL;
189 drive->pc_callback(drive, 0); 186 drive->pc_callback(drive, 0);
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 38076169b893..da2f97dfa8f8 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -178,7 +178,12 @@ EXPORT_SYMBOL(ide_complete_rq);
178 178
179void ide_kill_rq(ide_drive_t *drive, struct request *rq) 179void ide_kill_rq(ide_drive_t *drive, struct request *rq)
180{ 180{
181 if (rq->rq_disk) { 181 drive->failed_pc = NULL;
182
183 if (drive->media == ide_tape)
184 rq->errors = IDE_DRV_ERROR_GENERAL;
185
186 if (blk_special_request(rq) && rq->rq_disk) {
182 struct ide_driver *drv; 187 struct ide_driver *drv;
183 188
184 drv = *(struct ide_driver **)rq->rq_disk->private_data; 189 drv = *(struct ide_driver **)rq->rq_disk->private_data;
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index d6555984ee88..e3b4c1c39d37 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -152,11 +152,6 @@ struct idetape_bh {
152#define IDETAPE_LU_RETENSION_MASK 2 152#define IDETAPE_LU_RETENSION_MASK 2
153#define IDETAPE_LU_EOT_MASK 4 153#define IDETAPE_LU_EOT_MASK 4
154 154
155/* Error codes returned in rq->errors to the higher part of the driver. */
156#define IDETAPE_ERROR_GENERAL 101
157#define IDETAPE_ERROR_FILEMARK 102
158#define IDETAPE_ERROR_EOD 103
159
160/* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ 155/* Structures related to the SELECT SENSE / MODE SENSE packet commands. */
161#define IDETAPE_BLOCK_DESCRIPTOR 0 156#define IDETAPE_BLOCK_DESCRIPTOR 0
162#define IDETAPE_CAPABILITIES_PAGE 0x2a 157#define IDETAPE_CAPABILITIES_PAGE 0x2a
@@ -422,19 +417,19 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
422 } 417 }
423 } 418 }
424 if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { 419 if (pc->c[0] == READ_6 && (sense[2] & 0x80)) {
425 pc->error = IDETAPE_ERROR_FILEMARK; 420 pc->error = IDE_DRV_ERROR_FILEMARK;
426 pc->flags |= PC_FLAG_ABORT; 421 pc->flags |= PC_FLAG_ABORT;
427 } 422 }
428 if (pc->c[0] == WRITE_6) { 423 if (pc->c[0] == WRITE_6) {
429 if ((sense[2] & 0x40) || (tape->sense_key == 0xd 424 if ((sense[2] & 0x40) || (tape->sense_key == 0xd
430 && tape->asc == 0x0 && tape->ascq == 0x2)) { 425 && tape->asc == 0x0 && tape->ascq == 0x2)) {
431 pc->error = IDETAPE_ERROR_EOD; 426 pc->error = IDE_DRV_ERROR_EOD;
432 pc->flags |= PC_FLAG_ABORT; 427 pc->flags |= PC_FLAG_ABORT;
433 } 428 }
434 } 429 }
435 if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { 430 if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) {
436 if (tape->sense_key == 8) { 431 if (tape->sense_key == 8) {
437 pc->error = IDETAPE_ERROR_EOD; 432 pc->error = IDE_DRV_ERROR_EOD;
438 pc->flags |= PC_FLAG_ABORT; 433 pc->flags |= PC_FLAG_ABORT;
439 } 434 }
440 if (!(pc->flags & PC_FLAG_ABORT) && 435 if (!(pc->flags & PC_FLAG_ABORT) &&
@@ -474,7 +469,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
474 debug_log(DBG_PROCS, "Enter %s\n", __func__); 469 debug_log(DBG_PROCS, "Enter %s\n", __func__);
475 470
476 switch (uptodate) { 471 switch (uptodate) {
477 case 0: error = IDETAPE_ERROR_GENERAL; break; 472 case 0: error = IDE_DRV_ERROR_GENERAL; break;
478 case 1: error = 0; break; 473 case 1: error = 0; break;
479 default: error = uptodate; 474 default: error = uptodate;
480 } 475 }
@@ -669,7 +664,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
669 tape->ascq); 664 tape->ascq);
670 } 665 }
671 /* Giving up */ 666 /* Giving up */
672 pc->error = IDETAPE_ERROR_GENERAL; 667 pc->error = IDE_DRV_ERROR_GENERAL;
673 } 668 }
674 drive->failed_pc = NULL; 669 drive->failed_pc = NULL;
675 drive->pc_callback(drive, 0); 670 drive->pc_callback(drive, 0);
@@ -730,7 +725,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
730 } 725 }
731 pc->error = 0; 726 pc->error = 0;
732 } else { 727 } else {
733 pc->error = IDETAPE_ERROR_GENERAL; 728 pc->error = IDE_DRV_ERROR_GENERAL;
734 drive->failed_pc = NULL; 729 drive->failed_pc = NULL;
735 } 730 }
736 drive->pc_callback(drive, 0); 731 drive->pc_callback(drive, 0);
@@ -1210,7 +1205,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks,
1210 1205
1211 if (tape->merge_bh) 1206 if (tape->merge_bh)
1212 idetape_init_merge_buffer(tape); 1207 idetape_init_merge_buffer(tape);
1213 if (errors == IDETAPE_ERROR_GENERAL) 1208 if (errors == IDE_DRV_ERROR_GENERAL)
1214 return -EIO; 1209 return -EIO;
1215 return ret; 1210 return ret;
1216} 1211}
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 7237e1547b1f..f85b7f21a617 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -315,12 +315,8 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
315 break; 315 break;
316 } 316 }
317 317
318 if (sectors > 0) { 318 if (sectors > 0)
319 struct ide_driver *drv; 319 ide_end_request(drive, 1, sectors);
320
321 drv = *(struct ide_driver **)rq->rq_disk->private_data;
322 drv->end_request(drive, 1, sectors);
323 }
324 } 320 }
325 return ide_error(drive, s, stat); 321 return ide_error(drive, s, stat);
326} 322}
@@ -337,13 +333,7 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
337 return; 333 return;
338 } 334 }
339 335
340 if (rq->rq_disk) { 336 ide_end_request(drive, 1, rq->nr_sectors);
341 struct ide_driver *drv;
342
343 drv = *(struct ide_driver **)rq->rq_disk->private_data;;
344 drv->end_request(drive, 1, rq->nr_sectors);
345 } else
346 ide_end_request(drive, 1, rq->nr_sectors);
347} 337}
348 338
349/* 339/*