linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Brian King <brking@linux.vnet.ibm.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
	James Bottomley <James.Bottomley@SteelEye.com>,
	Alan <alan@lxorguk.ukuu.org.uk>,
	linux-scsi@vger.kernel.org,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>
Subject: [PATCH] libata: initialize qc->dma_dir to DMA_NONE
Date: Wed, 17 Jan 2007 11:34:02 +0900	[thread overview]
Message-ID: <20070117023402.GP10987@htj.dyndns.org> (raw)
In-Reply-To: <45AD60B9.3030501@linux.vnet.ibm.com>

libata didn't used to init qc->dma_dir to any specific value on qc
initialization and command translation path didn't set qc->dma_dir if
the command doesn't need data transfer.  This made non-data commands
to have random qc->dma_dir.

This usually doesn't cause problem because LLDs usually check
qc->protocol first and look at qc->dma_dir iff the command needs data
transfer but this doesn't hold for all LLDs.

It might be worthwhile to rename qc->dma_dir to qc->data_dir as we use
the field to tag data direction for both PIO and DMA protocols.

This problem has been spotted by James Bottomley.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: James Bottomley <James.Bottomley@SteelEye.com>

diff --git a/include/linux/libata.h b/include/linux/libata.h
index 7cfc18f..925ad7f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1139,6 +1139,7 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
 
 static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
 {
+	qc->dma_dir = DMA_NONE;
 	qc->__sg = NULL;
 	qc->flags = 0;
 	qc->cursect = qc->cursg = qc->cursg_ofs = 0;

  reply	other threads:[~2007-01-17  2:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16 22:24 ipr SATA problems in 2.6.20 Brian King
2007-01-16 22:41 ` Alan
2007-01-16 22:45   ` Jeff Garzik
2007-01-16 23:11     ` James Bottomley
2007-01-16 23:17       ` Brian King
2007-01-16 23:30         ` James Bottomley
2007-01-16 23:33         ` Brian King
2007-01-17  2:34           ` Tejun Heo [this message]
2007-01-17  3:43             ` [PATCH] libata: initialize qc->dma_dir to DMA_NONE Brian King
2007-01-17  3:59               ` Jeff Garzik
2007-01-17 14:37                 ` Brian King
2007-01-17 18:35                   ` Brian King
2007-01-17 15:19             ` James Bottomley
2007-01-17 15:49               ` Tejun Heo
2007-01-17 16:07                 ` James Bottomley
2007-01-20  0:19             ` Jeff Garzik
2007-01-16 23:28     ` ipr SATA problems in 2.6.20 Alan

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=20070117023402.GP10987@htj.dyndns.org \
    --to=htejun@gmail.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=brking@linux.vnet.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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).