asm-generic: add NEED_SG_DMA_LENGTH to define sg_dma_len()
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Wed, 26 May 2010 21:44:32 +0000 (14:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 27 May 2010 16:12:54 +0000 (09:12 -0700)
There are only two ways to define sg_dma_len(); use sg->dma_length or
sg->length.  This patch introduces NEED_SG_DMA_LENGTH that enables
architectures to choose sg->dma_length or sg->length.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/ia64/Kconfig
arch/sh/Kconfig
arch/sparc/Kconfig
arch/sparc/include/asm/scatterlist.h
arch/x86/Kconfig
include/asm-generic/scatterlist.h

index 9676100b83ee02563047459766d81ba59d701beb..f8afdd271f3d0c5183522762a1cc330cc3895703 100644 (file)
@@ -56,6 +56,9 @@ config MMU
 config NEED_DMA_MAP_STATE
        def_bool y
 
+config NEED_SG_DMA_LENGTH
+       def_bool y
+
 config SWIOTLB
        bool
 
index 0e318c905eea984d57824526f50be505be82ddbd..c5ee4ce60b576d0e5155e940f9230a29cc622639 100644 (file)
@@ -186,6 +186,9 @@ config DMA_NONCOHERENT
 config NEED_DMA_MAP_STATE
        def_bool DMA_NONCOHERENT
 
+config NEED_SG_DMA_LENGTH
+       def_bool y
+
 source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"
index d6781ce687e24cfeec3e8c9b61939f4b2a3831b8..6f1470baa314e8787213efedb78e0a3f9d6f9e56 100644 (file)
@@ -133,6 +133,9 @@ config ZONE_DMA
 config NEED_DMA_MAP_STATE
        def_bool y
 
+config NEED_SG_DMA_LENGTH
+       def_bool y
+
 config GENERIC_ISA_DMA
        bool
        default y if SPARC32
index 0fa0d6da2107f393771ad899b193ae4aab457dc6..69d21bb052f1e78cf937de604fc90c4b01c53100 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef _SPARC_SCATTERLIST_H
 #define _SPARC_SCATTERLIST_H
 
-#define sg_dma_len(sg)         ((sg)->dma_length)
-
 #define ISA_DMA_THRESHOLD      (~0UL)
 
 #include <asm-generic/scatterlist.h>
index e0c619c55b4e27149866cee2c932d8e2a6212f9b..5bdc143b122856cd6eb0e646eb4b5688bfbd3fad 100644 (file)
@@ -109,6 +109,9 @@ config SBUS
 config NEED_DMA_MAP_STATE
        def_bool (X86_64 || DMAR || DMA_API_DEBUG)
 
+config NEED_SG_DMA_LENGTH
+       def_bool X86_64
+
 config GENERIC_ISA_DMA
        def_bool y
 
index 51a7a43ab0ceea1d7a8949522db71a16600ce10a..5e087944a659bc326c6af4d787417e0718ea14cd 100644 (file)
@@ -11,7 +11,9 @@ struct scatterlist {
        unsigned int    offset;
        unsigned int    length;
        dma_addr_t      dma_address;
+#ifdef CONFIG_NEED_SG_DMA_LENGTH
        unsigned int    dma_length;
+#endif
 };
 
 /*
@@ -22,17 +24,12 @@ struct scatterlist {
  * is 0.
  */
 #define sg_dma_address(sg)     ((sg)->dma_address)
-#ifndef sg_dma_len
-/*
- * Normally, you have an iommu on 64 bit machines, but not on 32 bit
- * machines. Architectures that are differnt should override this.
- */
-#if __BITS_PER_LONG == 64
+
+#ifdef CONFIG_NEED_SG_DMA_LENGTH
 #define sg_dma_len(sg)         ((sg)->dma_length)
 #else
 #define sg_dma_len(sg)         ((sg)->length)
-#endif /* 64 bit */
-#endif /* sg_dma_len */
+#endif
 
 #define ARCH_HAS_SG_CHAIN