linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: petkovbb@googlemail.com, bzolnier@gmail.com, axboe@kernel.dk,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 06/15] ide-cd: clear sense buffer before issuing request sense
Date: Fri, 17 Apr 2009 18:33:13 +0900	[thread overview]
Message-ID: <1239960802-31978-7-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1239960802-31978-1-git-send-email-tj@kernel.org>

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>
---
 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 3aec19d..509f129 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,
 	if (sense == NULL)
 		sense = &info->sense_data;
 
+	memset(sense, 0, 18);
+
 	/* stuff the sense request in front of our current request */
 	blk_rq_init(NULL, rq);
 	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)
 	 * and some drives don't send them.  Sigh.
 	 */
 	if (rq->cmd[0] == GPCMD_REQUEST_SENSE &&
-	    cmd->nleft > 0 && cmd->nleft <= 5) {
-		unsigned int ofs = cmd->nbytes - cmd->nleft;
-
-		while (cmd->nleft > 0) {
-			*((u8 *)rq->data + ofs++) = 0;
-			cmd->nleft--;
-		}
-	}
+	    cmd->nleft > 0 && cmd->nleft <= 5)
+		cmd->nleft = 0;
 }
 
 int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
-- 
1.6.0.2


  parent reply	other threads:[~2009-04-17  9:33 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17  9:33 [PATCHSET pata-2.6] ide: rq->buffer, data, special and misc cleanups, take#2 Tejun Heo
2009-04-17  9:33 ` [PATCH 01/15] block: clear req->errors on bio completion only for fs requests Tejun Heo
2009-04-17  9:33 ` [PATCH 02/15] ide-tape: remove back-to-back REQUEST_SENSE detection Tejun Heo
2009-04-17 10:23   ` Borislav Petkov
2009-04-17 10:35     ` Tejun Heo
2009-04-17 10:40       ` Tejun Heo
2009-04-17 11:03         ` Borislav Petkov
2009-04-17 21:12           ` Tejun Heo
2009-04-17 21:27             ` Mark Lord
2009-04-18 19:48             ` Borislav Petkov
2009-04-18 21:39               ` Tejun Heo
2009-04-19  7:28                 ` Borislav Petkov
2009-04-19  7:36                   ` Tejun Heo
2009-04-18 16:51     ` Bartlomiej Zolnierkiewicz
2009-04-18 21:42       ` Tejun Heo
2009-04-17  9:33 ` [PATCH 03/15] ide: use blk_run_queue() instead of blk_start_queueing() Tejun Heo
2009-04-17  9:33 ` [PATCH 04/15] ide: don't set REQ_SOFTBARRIER Tejun Heo
2009-04-17  9:33 ` [PATCH 05/15] ide kill unused ide_cmd->special Tejun Heo
2009-04-17  9:33 ` Tejun Heo [this message]
2009-04-17  9:33 ` [PATCH 07/15] ide-floppy: block pc always uses bio Tejun Heo
2009-04-17  9:33 ` [PATCH 08/15] ide-taskfile: don't abuse rq->buffer Tejun Heo
2009-04-17  9:33 ` [PATCH 09/15] ide-atapi: " Tejun Heo
2009-04-17  9:33 ` [PATCH 10/15] ide-cd: " Tejun Heo
2009-04-17  9:33 ` [PATCH 11/15] ide: add helpers for preparing sense requests Tejun Heo
2009-04-17  9:33 ` [PATCH 12/15] ide-cd: convert to using generic sense request Tejun Heo
2009-04-19  9:22   ` Borislav Petkov
2009-04-19  9:28     ` Tejun Heo
2009-04-19  9:30       ` Tejun Heo
2009-04-17  9:33 ` [PATCH 13/15] ide-atapi: convert ide-{floppy,tape} to using preallocated sense buffer Tejun Heo
2009-04-17  9:33 ` [PATCH 14/15] ide-cd,atapi: use bio for internal commands Tejun Heo
2009-04-17  9:33 ` [PATCH 15/15] ide-pm: don't abuse rq->data Tejun Heo
2009-04-18 16:32 ` [PATCHSET pata-2.6] ide: rq->buffer, data, special and misc cleanups, take#2 Bartlomiej Zolnierkiewicz
2009-04-18 20:04   ` Borislav Petkov
2009-04-18 21:43   ` Tejun Heo
2009-04-18 22:04     ` [GIT PATCH " Tejun Heo
2009-04-20 11:47       ` Bartlomiej Zolnierkiewicz
2009-04-20 11:59         ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239960802-31978-7-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=petkovbb@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).