aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:25 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:25 -0500
commit8ee69f5a83660796ffa1d33e67d0064db44cfc23 (patch)
treeab474b35905d374261922d9805e235b8c742b4fc /drivers/ide/ide-cd.c
parent03f537d50af7381317351396480411b3e00e6c7e (diff)
ide-cd: factor out request sense fixup from cdrom_pc_intr()
This is a preparation for cdrom_pc_intr() and cdrom_newpc_intr() merge. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 44267fb47f2e..7eb1aa6a3113 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1047,6 +1047,20 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
1047 * Execute all other packet commands. 1047 * Execute all other packet commands.
1048 */ 1048 */
1049 1049
1050static void ide_cd_request_sense_fixup(struct request *rq)
1051{
1052 /*
1053 * Some of the trailing request sense fields are optional,
1054 * and some drives don't send them. Sigh.
1055 */
1056 if (rq->cmd[0] == GPCMD_REQUEST_SENSE &&
1057 rq->data_len > 0 && rq->data_len <= 5)
1058 while (rq->data_len > 0) {
1059 *(u8 *)rq->data++ = 0;
1060 --rq->data_len;
1061 }
1062}
1063
1050/* Interrupt routine for packet command completion. */ 1064/* Interrupt routine for packet command completion. */
1051static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) 1065static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1052{ 1066{
@@ -1069,16 +1083,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1069 /* If DRQ is clear, the command has completed. 1083 /* If DRQ is clear, the command has completed.
1070 Complain if we still have data left to transfer. */ 1084 Complain if we still have data left to transfer. */
1071 if ((stat & DRQ_STAT) == 0) { 1085 if ((stat & DRQ_STAT) == 0) {
1072 /* Some of the trailing request sense fields are optional, and 1086 ide_cd_request_sense_fixup(rq);
1073 some drives don't send them. Sigh. */
1074 if (rq->cmd[0] == GPCMD_REQUEST_SENSE &&
1075 rq->data_len > 0 &&
1076 rq->data_len <= 5) {
1077 while (rq->data_len > 0) {
1078 *(unsigned char *)rq->data++ = 0;
1079 --rq->data_len;
1080 }
1081 }
1082 1087
1083 if (rq->data_len == 0) 1088 if (rq->data_len == 0)
1084 cdrom_end_request(drive, 1); 1089 cdrom_end_request(drive, 1);