diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-07-16 14:33:46 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:46 -0400 |
commit | b6ca440a8ff15e12478ea6f026a52970e7a0c54c (patch) | |
tree | 2ef765d68021032f17e0e96092d685d4170958a5 /drivers/ide | |
parent | 99384aeafe3a78d8a2e66b09b67aa6a219cd7897 (diff) |
ide-cd: simplify request issuing path
Call cdrom_start_packet_command() only from the ->do_request() routine.
As a nice side effect, this improves code readability a bit.
There should be no functionality change resulting from this patch.
Signed-off-by: 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.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index a9be4bf87dd5..b61ce5ee08e2 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -753,14 +753,12 @@ static ide_startstop_t cdrom_start_seek_continuation(ide_drive_t *drive) | |||
753 | return cdrom_transfer_packet_command(drive, rq, &cdrom_seek_intr); | 753 | return cdrom_transfer_packet_command(drive, rq, &cdrom_seek_intr); |
754 | } | 754 | } |
755 | 755 | ||
756 | static ide_startstop_t cdrom_start_seek(ide_drive_t *drive) | 756 | static void cdrom_start_seek(ide_drive_t *drive) |
757 | { | 757 | { |
758 | struct cdrom_info *info = drive->driver_data; | 758 | struct cdrom_info *info = drive->driver_data; |
759 | 759 | ||
760 | info->dma = 0; | 760 | info->dma = 0; |
761 | info->start_seek = jiffies; | 761 | info->start_seek = jiffies; |
762 | return cdrom_start_packet_command(drive, 0, | ||
763 | cdrom_start_seek_continuation); | ||
764 | } | 762 | } |
765 | 763 | ||
766 | /* | 764 | /* |
@@ -1135,8 +1133,7 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) | |||
1135 | if (write) | 1133 | if (write) |
1136 | cd->devinfo.media_written = 1; | 1134 | cd->devinfo.media_written = 1; |
1137 | 1135 | ||
1138 | /* start sending the read/write request to the drive */ | 1136 | return ide_started; |
1139 | return cdrom_start_packet_command(drive, 32768, cdrom_start_rw_cont); | ||
1140 | } | 1137 | } |
1141 | 1138 | ||
1142 | static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive) | 1139 | static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive) |
@@ -1149,7 +1146,7 @@ static ide_startstop_t cdrom_do_newpc_cont(ide_drive_t *drive) | |||
1149 | return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); | 1146 | return cdrom_transfer_packet_command(drive, rq, cdrom_newpc_intr); |
1150 | } | 1147 | } |
1151 | 1148 | ||
1152 | static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | 1149 | static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) |
1153 | { | 1150 | { |
1154 | struct cdrom_info *info = drive->driver_data; | 1151 | struct cdrom_info *info = drive->driver_data; |
1155 | 1152 | ||
@@ -1188,10 +1185,6 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1188 | ((unsigned long)current->stack & stack_mask))) | 1185 | ((unsigned long)current->stack & stack_mask))) |
1189 | info->dma = 0; | 1186 | info->dma = 0; |
1190 | } | 1187 | } |
1191 | |||
1192 | /* start sending the command to the drive */ | ||
1193 | return cdrom_start_packet_command(drive, rq->data_len, | ||
1194 | cdrom_do_newpc_cont); | ||
1195 | } | 1188 | } |
1196 | 1189 | ||
1197 | /* | 1190 | /* |
@@ -1200,8 +1193,9 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1200 | static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | 1193 | static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, |
1201 | sector_t block) | 1194 | sector_t block) |
1202 | { | 1195 | { |
1203 | ide_startstop_t action; | ||
1204 | struct cdrom_info *info = drive->driver_data; | 1196 | struct cdrom_info *info = drive->driver_data; |
1197 | ide_handler_t *fn; | ||
1198 | int xferlen; | ||
1205 | 1199 | ||
1206 | if (blk_fs_request(rq)) { | 1200 | if (blk_fs_request(rq)) { |
1207 | if (info->cd_flags & IDE_CD_FLAG_SEEKING) { | 1201 | if (info->cd_flags & IDE_CD_FLAG_SEEKING) { |
@@ -1221,16 +1215,23 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1221 | } | 1215 | } |
1222 | if (rq_data_dir(rq) == READ && | 1216 | if (rq_data_dir(rq) == READ && |
1223 | IDE_LARGE_SEEK(info->last_block, block, | 1217 | IDE_LARGE_SEEK(info->last_block, block, |
1224 | IDECD_SEEK_THRESHOLD) && | 1218 | IDECD_SEEK_THRESHOLD) && |
1225 | drive->dsc_overlap) | 1219 | drive->dsc_overlap) { |
1226 | action = cdrom_start_seek(drive); | 1220 | xferlen = 0; |
1227 | else | 1221 | fn = cdrom_start_seek_continuation; |
1228 | action = cdrom_start_rw(drive, rq); | 1222 | cdrom_start_seek(drive); |
1223 | } else { | ||
1224 | xferlen = 32768; | ||
1225 | fn = cdrom_start_rw_cont; | ||
1226 | if (cdrom_start_rw(drive, rq) == ide_stopped) | ||
1227 | return ide_stopped; | ||
1228 | } | ||
1229 | info->last_block = block; | 1229 | info->last_block = block; |
1230 | return action; | ||
1231 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || | 1230 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || |
1232 | rq->cmd_type == REQ_TYPE_ATA_PC) { | 1231 | rq->cmd_type == REQ_TYPE_ATA_PC) { |
1233 | return cdrom_do_block_pc(drive, rq); | 1232 | xferlen = rq->data_len; |
1233 | fn = cdrom_do_newpc_cont; | ||
1234 | cdrom_do_block_pc(drive, rq); | ||
1234 | } else if (blk_special_request(rq)) { | 1235 | } else if (blk_special_request(rq)) { |
1235 | /* right now this can only be a reset... */ | 1236 | /* right now this can only be a reset... */ |
1236 | cdrom_end_request(drive, 1); | 1237 | cdrom_end_request(drive, 1); |
@@ -1240,6 +1241,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1240 | cdrom_end_request(drive, 0); | 1241 | cdrom_end_request(drive, 0); |
1241 | return ide_stopped; | 1242 | return ide_stopped; |
1242 | } | 1243 | } |
1244 | |||
1245 | return cdrom_start_packet_command(drive, xferlen, fn); | ||
1243 | } | 1246 | } |
1244 | 1247 | ||
1245 | 1248 | ||