linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, Tejun Heo <htejun@gmail.com>,
	Natalie Protasevich <protasnb@gmail.com>,
	Jeff Garzik <jgarzik@pobox.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-ide@vger.kernel.org, Jens Axboe <jens.axboe@oracle.com>,
	linux-pcmcia@lists.infradead.org
Subject: [PATCH 1/1] introduce DMA_MASK_NONE as a signal for unable to do DMA
Date: Sun, 16 Sep 2007 12:15:12 -0500	[thread overview]
Message-ID: <1189962913.3383.9.camel@localhost.localdomain> (raw)
In-Reply-To: <1189962755.3383.5.camel@localhost.localdomain>

Some devices are incapable of DMA and need to be recognised as such.
Introduce a NONE dma mask to facilitate this plus an inline function:
is_device_dma_capable() to check this.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 2dc21cb..0ebfafb 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -24,6 +24,8 @@ enum dma_data_direction {
 #define DMA_28BIT_MASK	0x000000000fffffffULL
 #define DMA_24BIT_MASK	0x0000000000ffffffULL
 
+#define DMA_MASK_NONE	0x0ULL
+
 static inline int valid_dma_direction(int dma_direction)
 {
 	return ((dma_direction == DMA_BIDIRECTIONAL) ||
@@ -31,6 +33,11 @@ static inline int valid_dma_direction(int dma_direction)
 		(dma_direction == DMA_FROM_DEVICE));
 }
 
+static inline int is_device_dma_capable(struct device *dev)
+{
+	return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
+}
+
 #ifdef CONFIG_HAS_DMA
 #include <asm/dma-mapping.h>
 #else
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 90ef552..f047a1f 100644



  reply	other threads:[~2007-09-16 17:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08 22:31 SATA open bugs Natalie Protasevich
2007-08-09  2:17 ` Mark Lord
2007-08-09  3:58 ` Tejun Heo
2007-08-09  5:44   ` Jens Axboe
2007-08-09 11:17   ` Matt Sealey
2007-08-09 13:53   ` AMD64 dma_alloc_coherent crashes on non PCI device (was SATA open bugs) Alan Cox
2007-08-09 17:05     ` Andi Kleen
2007-08-09 17:21       ` Alan Cox
2007-08-09 17:23         ` Andi Kleen
2007-08-09 17:53           ` Alan Cox
2007-08-09 19:28             ` Andi Kleen
2007-08-09 22:34               ` Alan Cox
2007-08-09 22:43                 ` Andi Kleen
2007-08-09 23:14                   ` Alan Cox
2007-08-09 23:08                     ` Andi Kleen
2007-08-09 23:11                     ` AMD64 dma_alloc_coherent crashes on non PCI device (was SATA open bugs) II Andi Kleen
2007-08-09 23:24                       ` Alan Cox
2007-08-10  9:43                         ` Andi Kleen
2007-08-10 13:54                           ` Alan Cox
2007-08-10 14:52                             ` James Bottomley
2007-08-10 16:58                               ` Alan Cox
2007-08-10 18:28                                 ` James Bottomley
2007-08-10 20:27                                   ` Andi Kleen
2007-09-16 17:12                                     ` James Bottomley
2007-09-16 17:15                                       ` James Bottomley [this message]
2007-09-16 17:16                                       ` [Patch 2/2] pcmcia: use DMA_MASK_NONE for the default for all pcmcia devices James Bottomley
2007-08-09 20:19             ` AMD64 dma_alloc_coherent crashes on non PCI device (was SATA open bugs) James Bottomley
2007-08-09 22:37               ` Alan Cox
2007-08-09 22:53                 ` James Bottomley
2007-08-09 23:17                   ` Alan Cox
2007-08-09 23:26                     ` James Bottomley
2007-08-09  5:28 ` SATA open bugs James Bottomley

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=1189962913.3383.9.camel@localhost.localdomain \
    --to=james.bottomley@steeleye.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=htejun@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=protasnb@gmail.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).