diff mbox

sparc: use asm-generic/scatterlist.h

Message ID 20100226093941C.fujita.tomonori@lab.ntt.co.jp
State Accepted
Delegated to: David Miller
Headers show

Commit Message

FUJITA Tomonori Feb. 26, 2010, 12:43 a.m. UTC
sparc's scatterlist structure is identical to the generic one.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 arch/sparc/include/asm/scatterlist.h |   21 +--------------------
 1 files changed, 1 insertions(+), 20 deletions(-)

Comments

David Miller Feb. 26, 2010, 12:35 p.m. UTC | #1
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Fri, 26 Feb 2010 09:43:51 +0900

> sparc's scatterlist structure is identical to the generic one.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Applied, thank you.

BTW, the conditional sg_dma_len() definition cpp games done
in asm-generic/scatterlist.h might be superfluous these days.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
FUJITA Tomonori March 1, 2010, 6:05 a.m. UTC | #2
On Fri, 26 Feb 2010 04:35:36 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Date: Fri, 26 Feb 2010 09:43:51 +0900
> 
> > sparc's scatterlist structure is identical to the generic one.
> > 
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> 
> Applied, thank you.

Thanks,

> BTW, the conditional sg_dma_len() definition cpp games done
> in asm-generic/scatterlist.h might be superfluous these days.

You are referring to the following code (I guess that this hack came
from x86)?

#if __BITS_PER_LONG == 64
#define sg_dma_len(sg)		((sg)->dma_length)
#else
#define sg_dma_len(sg)		((sg)->length)
#endif /* 64 bit */

if so, seems that you are right. we could simply have:

#define sg_dma_len(sg)		((sg)->dma_length)

The current users of asm-generic/scatterlist.h are microblaze, s390,
score, sh, and x86.

The first three users don't support DMA so sg_dma_len doesn't matter
for them.

sh and x86_32 use sg->length, x86_64 uses sg->dma_length. However, sh
and x86_32 sets dma_length in dma_map_sg() so they can use
sg->dma_length.

I'll clean up this in the next merge window.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 1, 2010, 7:03 a.m. UTC | #3
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Mon, 1 Mar 2010 15:05:48 +0900

> I'll clean up this in the next merge window.

Sounds great!
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann March 1, 2010, 11:29 a.m. UTC | #4
On Monday 01 March 2010, FUJITA Tomonori wrote:
> On Fri, 26 Feb 2010 04:35:36 -0800 (PST)
> David Miller <davem@davemloft.net> wrote:
>
> You are referring to the following code (I guess that this hack came
> from x86)?
> 
> #if __BITS_PER_LONG == 64
> #define sg_dma_len(sg)          ((sg)->dma_length)
> #else
> #define sg_dma_len(sg)          ((sg)->length)
> #endif /* 64 bit */
> 
> if so, seems that you are right. we could simply have:
> 
> #define sg_dma_len(sg)          ((sg)->dma_length)

I did it the above way so it would work for any architecture that
wants it. IIRC, similar constructs were used in multiple architectures
before, using the __BITS_PER_LONG macro made this portable.
 
> The current users of asm-generic/scatterlist.h are microblaze, s390,
> score, sh, and x86.
> 
> The first three users don't support DMA so sg_dma_len doesn't matter
> for them.
> 
> sh and x86_32 use sg->length, x86_64 uses sg->dma_length. However, sh
> and x86_32 sets dma_length in dma_map_sg() so they can use
> sg->dma_length.
> 
> I'll clean up this in the next merge window.

Ok, great. I think a good way to clean this up would be to convert
all architectures to use asm-generic/scatterlist.h first, and then
move it to linux/scatterlist once it is architecture intedepent.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
index e580f55..d112025 100644
--- a/arch/sparc/include/asm/scatterlist.h
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -1,27 +1,8 @@ 
 #ifndef _SPARC_SCATTERLIST_H
 #define _SPARC_SCATTERLIST_H
 
-#include <asm/page.h>
-#include <asm/types.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
-	unsigned long	sg_magic;
-#endif
-	unsigned long	page_link;
-	unsigned int	offset;
-
-	unsigned int	length;
-
-	dma_addr_t	dma_address;
-	__u32		dma_length;
-};
-
-#define sg_dma_address(sg)	((sg)->dma_address)
 #define sg_dma_len(sg)     	((sg)->dma_length)
 
-#define ISA_DMA_THRESHOLD	(~0UL)
-
-#define ARCH_HAS_SG_CHAIN
+#include <asm-generic/scatterlist.h>
 
 #endif /* !(_SPARC_SCATTERLIST_H) */