From: TARUISI Hiroaki Date: Thu, 11 Aug 2011 11:25:20 +0000 (+0900) Subject: [SCSI] Fix out of spec CD-ROM problem with media change X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dfcf7775815504d13a1d273073810058caf84b9d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [SCSI] Fix out of spec CD-ROM problem with media change Some CD-ROMs fail to report a media change correctly. The specific one for this patch simply fails to respond to commands, then gives a UNIT ATTENTION after being reset which returns ASC/ASCQ 28/00. This is out of spec behaviour, but add a check in the eat CC/UA on reset path to catch this case so the CD-ROM will function somewhat properly. [jejb: fixed up white space and accepted without signoff] Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index a4b9cdbaaa0b..dc6131e6a1ba 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -293,8 +293,16 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) * so that we can deal with it there. */ if (scmd->device->expecting_cc_ua) { - scmd->device->expecting_cc_ua = 0; - return NEEDS_RETRY; + /* + * Because some device does not queue unit + * attentions correctly, we carefully check + * additional sense code and qualifier so as + * not to squash media change unit attention. + */ + if (sshdr.asc != 0x28 || sshdr.ascq != 0x00) { + scmd->device->expecting_cc_ua = 0; + return NEEDS_RETRY; + } } /* * if the device is in the process of becoming ready, we