public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Boutcher <sleddog@us.ibm.com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	paulus@samba.org, anton@samba.org
Subject: Re: [PATCH] ibmvscsi driver - sixth version
Date: Wed, 31 Mar 2004 16:37:37 -0600	[thread overview]
Message-ID: <opr5qzszzml6e53g@us.ibm.com> (raw)
In-Reply-To: <1080770310.2071.44.camel@mulgrave>

On 31 Mar 2004 16:58:28 -0500, James Bottomley 
<James.Bottomley@SteelEye.com> wrote:
> Actually, this:
>
> +	    (u64) (unsigned long)dma_map_single(dev, cmd->request_buffer,
> +						cmd->request_bufflen,
> +						DMA_BIDIRECTIONAL);
> +	if (pci_dma_mapping_error(data->virtual_address)) {
> +		printk(KERN_ERR
> +		       "ibmvscsi: Unable to map request_buffer for command!\n");
> +		return 0;
>
> Should be
>
> if(dma_mapping_error())
>
> I have no idea why there are two identical APIs for the mapping error,
> but since you use the DMA API, you should use its version.  You can also
> drop the #include <linux/pci.h> as well.

Well, that would be true if arch/ppc64 had dma_mapping_error implemented.
Which it not.  You would need something like the following patch, which
will show up when we rationalize it with the rest of ppc64 and an
appropriate bk pull happens...I'll work with my ppc64 bretheren and then
re-submit the ibmvscsi patch.

===== dma-mapping.h 1.5 vs edited =====
--- 1.5/include/asm-ppc64/dma-mapping.hTue Mar 16 18:47:00 2004
+++ edited/dma-mapping.hWed Mar 31 16:33:07 2004
@@ -15,6 +15,11 @@
  #include <asm/scatterlist.h>
  #include <asm/bug.h>

+#define DMA_ERROR_CODE      (~(dma_addr_t)0x0)
+static inline int dma_mapping_error(dma_addr_t dma_addr) {
+        return (dma_addr == DMA_ERROR_CODE);
+}
+
  extern int dma_supported(struct device *dev, u64 mask);
  extern int dma_set_mask(struct device *dev, u64 dma_mask);
  extern void *dma_alloc_coherent(struct device *dev, size_t size,

> This:
>
> +	sg_mapped = dma_map_sg(dev, sg, cmd->use_sg, DMA_BIDIRECTIONAL);
> +
> +	if (pci_dma_mapping_error(sg_dma_address(&sg[0])))
> +		return 0;
>
> Is wrong.  dma_map_sg returns zero if there's a mapping error, you
> should check for that.

Yes, my bad.  I was so delighted with pci_dma_mapping_error() that I
got a little carried away.  Thanks.

Dave B

  reply	other threads:[~2004-03-31 22:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <opr3u0ffo7l6e53g@us.ibm.com>
     [not found] ` <20040225134518.A4238@infradead.org>
     [not found]   ` <opr3xta6gbl6e53g@us.ibm.com>
     [not found]     ` <1079027038.2820.57.camel@mulgrave>
2004-03-31 21:26       ` [PATCH] ibmvscsi driver - sixth version Dave Boutcher
2004-03-31 21:58         ` James Bottomley
2004-03-31 22:37           ` Dave Boutcher [this message]
2004-03-31 22:02         ` Jeff Garzik
2004-03-31 23:12           ` Dave Boutcher
2004-03-31 23:39             ` James Bottomley
2004-03-31 23:51               ` Dave Boutcher
2004-04-01  0:10                 ` Jeff Garzik
2004-04-01  0:16             ` Jeff Garzik

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=opr5qzszzml6e53g@us.ibm.com \
    --to=sleddog@us.ibm.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=paulus@samba.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