Re: [PATCH] sparc: use asm-generic/scatterlist.h

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: FUJITA Tomonori
Date: Monday, March 1, 2010 - 8:33 pm

On Mon, 1 Mar 2010 12:29:51 +0100
Arnd Bergmann <arnd@arndb.de> wrote:


Yeah, but the following assumption are not true for sparc, parisc, and
even x86_32 so this ccp trick is not so useful:

/*
 * Normally, you have an iommu on 64 bit machines, but not on 32 bit
 * machines. Architectures that are differnt should override this.
*/


If we go with such approach, then we could use something like the
following. There are only two kinds of scatterlist definitions (use
dma_length or not) so we can cover all the architectures.

diff --git a/include/asm-generic/scatterlist.h b/include/asm-generic/scatterlist.h
index 8b94544..1bf620d 100644
--- a/include/asm-generic/scatterlist.h
+++ b/include/asm-generic/scatterlist.h
@@ -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,11 @@ 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
 
 #ifndef ISA_DMA_THRESHOLD
 #define ISA_DMA_THRESHOLD	(~0UL)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] sparc: use asm-generic/scatterlist.h, FUJITA Tomonori, (Thu Feb 25, 5:43 pm)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, David Miller, (Fri Feb 26, 5:35 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, FUJITA Tomonori, (Sun Feb 28, 11:05 pm)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, David Miller, (Mon Mar 1, 12:03 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, Arnd Bergmann, (Mon Mar 1, 4:29 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, FUJITA Tomonori, (Mon Mar 1, 8:33 pm)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, Arnd Bergmann, (Tue Mar 2, 5:03 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, FUJITA Tomonori, (Tue Mar 2, 5:25 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, Arnd Bergmann, (Tue Mar 2, 6:38 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, FUJITA Tomonori, (Tue Mar 2, 6:49 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, Arnd Bergmann, (Tue Mar 2, 6:54 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, David Miller, (Tue Mar 2, 6:55 am)
Re: [PATCH] sparc: use asm-generic/scatterlist.h, FUJITA Tomonori, (Tue Mar 2, 7:06 am)