aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 310e497b5838..c8d0e8715997 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -670,8 +670,8 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector,
670 * and attempt to recover if there are problems. Returns 0 if everything's 670 * and attempt to recover if there are problems. Returns 0 if everything's
671 * ok; nonzero if the request has been terminated. 671 * ok; nonzero if the request has been terminated.
672 */ 672 */
673static 673static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
674int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw) 674 int len, int ireason, int rw)
675{ 675{
676 /* 676 /*
677 * ireason == 0: the drive wants to receive data from us 677 * ireason == 0: the drive wants to receive data from us
@@ -701,6 +701,9 @@ int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw)
701 drive->name, __FUNCTION__, ireason); 701 drive->name, __FUNCTION__, ireason);
702 } 702 }
703 703
704 if (rq->cmd_type == REQ_TYPE_ATA_PC)
705 rq->cmd_flags |= REQ_FAILED;
706
704 cdrom_end_request(drive, 0); 707 cdrom_end_request(drive, 0);
705 return -1; 708 return -1;
706} 709}
@@ -1071,11 +1074,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1071 /* 1074 /*
1072 * check which way to transfer data 1075 * check which way to transfer data
1073 */ 1076 */
1074 if (blk_fs_request(rq) || blk_pc_request(rq)) { 1077 if (ide_cd_check_ireason(drive, rq, len, ireason, write))
1075 if (ide_cd_check_ireason(drive, len, ireason, write)) 1078 return ide_stopped;
1076 return ide_stopped;
1077 1079
1078 if (blk_fs_request(rq) && write == 0) { 1080 if (blk_fs_request(rq)) {
1081 if (write == 0) {
1079 int nskip; 1082 int nskip;
1080 1083
1081 if (ide_cd_check_transfer_size(drive, len)) { 1084 if (ide_cd_check_transfer_size(drive, len)) {
@@ -1101,16 +1104,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1101 if (ireason == 0) { 1104 if (ireason == 0) {
1102 write = 1; 1105 write = 1;
1103 xferfunc = HWIF(drive)->atapi_output_bytes; 1106 xferfunc = HWIF(drive)->atapi_output_bytes;
1104 } else if (ireason == 2 || (ireason == 1 && 1107 } else {
1105 (blk_fs_request(rq) || blk_pc_request(rq)))) {
1106 write = 0; 1108 write = 0;
1107 xferfunc = HWIF(drive)->atapi_input_bytes; 1109 xferfunc = HWIF(drive)->atapi_input_bytes;
1108 } else {
1109 printk(KERN_ERR "%s: %s: The drive "
1110 "appears confused (ireason = 0x%02x). "
1111 "Trying to recover by ending request.\n",
1112 drive->name, __FUNCTION__, ireason);
1113 goto end_request;
1114 } 1110 }
1115 1111
1116 /* 1112 /*
@@ -1182,11 +1178,10 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1182 else 1178 else
1183 rq->data += blen; 1179 rq->data += blen;
1184 } 1180 }
1181 if (!write && blk_sense_request(rq))
1182 rq->sense_len += blen;
1185 } 1183 }
1186 1184
1187 if (write && blk_sense_request(rq))
1188 rq->sense_len += thislen;
1189
1190 /* 1185 /*
1191 * pad, if necessary 1186 * pad, if necessary
1192 */ 1187 */
@@ -1931,6 +1926,7 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
1931 { "MATSHITADVD-ROM SR-8186", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, 1926 { "MATSHITADVD-ROM SR-8186", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK },
1932 { "MATSHITADVD-ROM SR-8176", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, 1927 { "MATSHITADVD-ROM SR-8176", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK },
1933 { "MATSHITADVD-ROM SR-8174", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, 1928 { "MATSHITADVD-ROM SR-8174", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK },
1929 { "Optiarc DVD RW AD-5200A", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK },
1934 { NULL, NULL, 0 } 1930 { NULL, NULL, 0 }
1935}; 1931};
1936 1932