diff options
author | Tejun Heo <tj@kernel.org> | 2009-04-18 18:00:41 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-04-28 01:37:29 -0400 |
commit | 59a4f6f355fc718581ddcf1bb45a469d4756c035 (patch) | |
tree | 4593ab2fdf3a8521a63c07b47c717c1e6d84e6ff /drivers/ide/ide-cd.c | |
parent | 214ae19104141404f18ad6651752eb38e3dd584e (diff) |
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: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 3d4e09969763..b6a0d126b576 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -217,6 +217,8 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, | |||
217 | if (sense == NULL) | 217 | if (sense == NULL) |
218 | sense = &info->sense_data; | 218 | sense = &info->sense_data; |
219 | 219 | ||
220 | memset(sense, 0, 18); | ||
221 | |||
220 | /* stuff the sense request in front of our current request */ | 222 | /* stuff the sense request in front of our current request */ |
221 | blk_rq_init(NULL, rq); | 223 | blk_rq_init(NULL, rq); |
222 | rq->cmd_type = REQ_TYPE_ATA_PC; | 224 | 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 | * and some drives don't send them. Sigh. | 506 | * and some drives don't send them. Sigh. |
505 | */ | 507 | */ |
506 | if (rq->cmd[0] == GPCMD_REQUEST_SENSE && | 508 | if (rq->cmd[0] == GPCMD_REQUEST_SENSE && |
507 | cmd->nleft > 0 && cmd->nleft <= 5) { | 509 | cmd->nleft > 0 && cmd->nleft <= 5) |
508 | unsigned int ofs = cmd->nbytes - cmd->nleft; | 510 | cmd->nleft = 0; |
509 | |||
510 | while (cmd->nleft > 0) { | ||
511 | *((u8 *)rq->data + ofs++) = 0; | ||
512 | cmd->nleft--; | ||
513 | } | ||
514 | } | ||
515 | } | 511 | } |
516 | 512 | ||
517 | int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | 513 | int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, |