Commit 1873b90c authored by Tejun Heo's avatar Tejun Heo

ide-cd: clear sense buffer before issuing request sense

Impact: code simplification

ide_cd_request_sense_fixup() clears the tail of the sense buffer if
the device didn't completely fill it.  This patch makes
cdrom_queue_request_sense() clear the sense buffer before issuing the
command instead of clearing it afterwards.  This simplifies code and
eases future changes.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 46a802e8
...@@ -217,6 +217,8 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, ...@@ -217,6 +217,8 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
if (sense == NULL) if (sense == NULL)
sense = &info->sense_data; sense = &info->sense_data;
memset(sense, 0, 18);
/* stuff the sense request in front of our current request */ /* stuff the sense request in front of our current request */
blk_rq_init(NULL, rq); blk_rq_init(NULL, rq);
rq->cmd_type = REQ_TYPE_ATA_PC; rq->cmd_type = REQ_TYPE_ATA_PC;
...@@ -504,14 +506,8 @@ static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -504,14 +506,8 @@ static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd)
* and some drives don't send them. Sigh. * and some drives don't send them. Sigh.
*/ */
if (rq->cmd[0] == GPCMD_REQUEST_SENSE && if (rq->cmd[0] == GPCMD_REQUEST_SENSE &&
cmd->nleft > 0 && cmd->nleft <= 5) { cmd->nleft > 0 && cmd->nleft <= 5)
unsigned int ofs = cmd->nbytes - cmd->nleft; cmd->nleft = 0;
while (cmd->nleft > 0) {
*((u8 *)rq->data + ofs++) = 0;
cmd->nleft--;
}
}
} }
int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment