]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
introduce DMA_MASK_NONE as a signal for unable to do DMA
authorJames Bottomley <James.Bottomley@SteelEye.com>
Tue, 16 Oct 2007 08:23:55 +0000 (01:23 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 16 Oct 2007 16:42:50 +0000 (09:42 -0700)
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>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Natalie Protasevich <protasnb@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/dma-mapping.h

index 2dc21cbeb3049a0d9a2ffa2d0ee27271c66d1c62..0ebfafbd338ca56fc89f781c2848a9c16b81cb6d 100644 (file)
@@ -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