aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:02 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:02 -0400
commite0458ccb0668edbecbc1ae1c17ed58a6b1a4ff3e (patch)
tree23602333f5e054a5096f43f4d60af235f2764e7d /drivers/ide
parent299c4852fc6995e0665d246927d25cefd4dad754 (diff)
ide-cd: unify ide_cd_do_request() exit paths
* Move cdrom_end_request() calls from cdrom_start_rw() and ide_cd_prepare_rw_request() to ide_cd_do_request(). * Unify ide_cd_do_request() exit paths. There should be no functional changes caused by this patch. Cc: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index eb0c2fe2b874..3e3058cff843 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -595,7 +595,6 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,
595 printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n", 595 printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n",
596 drive->name, __func__, 596 drive->name, __func__,
597 rq->current_nr_sectors); 597 rq->current_nr_sectors);
598 cdrom_end_request(drive, 0);
599 return ide_stopped; 598 return ide_stopped;
600 } 599 }
601 rq->current_nr_sectors += nskip; 600 rq->current_nr_sectors += nskip;
@@ -972,10 +971,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
972 971
973 if (write) { 972 if (write) {
974 /* disk has become write protected */ 973 /* disk has become write protected */
975 if (get_disk_ro(cd->disk)) { 974 if (get_disk_ro(cd->disk))
976 cdrom_end_request(drive, 0);
977 return ide_stopped; 975 return ide_stopped;
978 }
979 } else { 976 } else {
980 /* 977 /*
981 * We may be retrying this request after an error. Fix up any 978 * We may be retrying this request after an error. Fix up any
@@ -987,10 +984,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
987 /* use DMA, if possible / writes *must* be hardware frame aligned */ 984 /* use DMA, if possible / writes *must* be hardware frame aligned */
988 if ((rq->nr_sectors & (sectors_per_frame - 1)) || 985 if ((rq->nr_sectors & (sectors_per_frame - 1)) ||
989 (rq->sector & (sectors_per_frame - 1))) { 986 (rq->sector & (sectors_per_frame - 1))) {
990 if (write) { 987 if (write)
991 cdrom_end_request(drive, 0);
992 return ide_stopped; 988 return ide_stopped;
993 }
994 drive->dma = 0; 989 drive->dma = 0;
995 } else 990 } else
996 drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); 991 drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
@@ -1045,6 +1040,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1045 sector_t block) 1040 sector_t block)
1046{ 1041{
1047 struct ide_cmd cmd; 1042 struct ide_cmd cmd;
1043 int uptodate = 0;
1048 1044
1049 ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", 1045 ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu",
1050 rq->cmd[0], (unsigned long long)block); 1046 rq->cmd[0], (unsigned long long)block);
@@ -1053,11 +1049,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1053 blk_dump_rq_flags(rq, "ide_cd_do_request"); 1049 blk_dump_rq_flags(rq, "ide_cd_do_request");
1054 1050
1055 if (blk_fs_request(rq)) { 1051 if (blk_fs_request(rq)) {
1056 if (cdrom_start_rw(drive, rq) == ide_stopped) 1052 if (cdrom_start_rw(drive, rq) == ide_stopped ||
1057 return ide_stopped; 1053 ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
1058 1054 goto out_end;
1059 if (ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
1060 return ide_stopped;
1061 } else if (blk_sense_request(rq) || blk_pc_request(rq) || 1055 } else if (blk_sense_request(rq) || blk_pc_request(rq) ||
1062 rq->cmd_type == REQ_TYPE_ATA_PC) { 1056 rq->cmd_type == REQ_TYPE_ATA_PC) {
1063 if (!rq->timeout) 1057 if (!rq->timeout)
@@ -1066,12 +1060,11 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1066 cdrom_do_block_pc(drive, rq); 1060 cdrom_do_block_pc(drive, rq);
1067 } else if (blk_special_request(rq)) { 1061 } else if (blk_special_request(rq)) {
1068 /* right now this can only be a reset... */ 1062 /* right now this can only be a reset... */
1069 cdrom_end_request(drive, 1); 1063 uptodate = 1;
1070 return ide_stopped; 1064 goto out_end;
1071 } else { 1065 } else {
1072 blk_dump_rq_flags(rq, DRV_NAME " bad flags"); 1066 blk_dump_rq_flags(rq, DRV_NAME " bad flags");
1073 cdrom_end_request(drive, 0); 1067 goto out_end;
1074 return ide_stopped;
1075 } 1068 }
1076 1069
1077 memset(&cmd, 0, sizeof(cmd)); 1070 memset(&cmd, 0, sizeof(cmd));
@@ -1082,6 +1075,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
1082 cmd.rq = rq; 1075 cmd.rq = rq;
1083 1076
1084 return ide_issue_pc(drive, &cmd); 1077 return ide_issue_pc(drive, &cmd);
1078out_end:
1079 cdrom_end_request(drive, uptodate);
1080 return ide_stopped;
1085} 1081}
1086 1082
1087/* 1083/*