2010-04-05 23:54:42

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 00/12] use asm-generic/scatterlist.h on every architecture (the second half)

All the architectures are converted to use
asm-generic/scatterlist.h. The first half is:

http://marc.info/?l=linux-kernel&m=127039230002523&w=2

=
arch/alpha/include/asm/scatterlist.h | 4 +--
arch/arm/include/asm/scatterlist.h | 3 --
arch/avr32/include/asm/scatterlist.h | 20 +-------------
arch/blackfin/include/asm/scatterlist.h | 22 +---------------
arch/cris/include/asm/scatterlist.h | 17 +-----------
arch/frv/include/asm/scatterlist.h | 40 +----------------------------
arch/h8300/include/asm/scatterlist.h | 12 +--------
arch/ia64/include/asm/scatterlist.h | 4 +-
arch/m32r/include/asm/scatterlist.h | 15 +----------
arch/m68k/include/asm/scatterlist.h | 16 +-----------
arch/microblaze/include/asm/scatterlist.h | 4 +-
arch/mips/include/asm/scatterlist.h | 22 +---------------
arch/mn10300/include/asm/scatterlist.h | 39 +---------------------------
arch/parisc/Kconfig | 3 ++
arch/parisc/include/asm/scatterlist.h | 20 +-------------
arch/powerpc/include/asm/scatterlist.h | 1 +
arch/sparc/include/asm/scatterlist.h | 5 ++-
arch/x86/include/asm/scatterlist.h | 5 ++-
arch/xtensa/include/asm/scatterlist.h | 23 +----------------
include/asm-generic/scatterlist.h | 2 -
20 files changed, 27 insertions(+), 250 deletions(-)


2010-04-05 23:54:51

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 01/12] asm-generic: remove ARCH_HAS_SG_CHAIN in scatterlist.h

There are more architectures that don't support ARCH_HAS_SG_CHAIN than
those that support it. This removes removes ARCH_HAS_SG_CHAIN in
asm-generic/scatterlist.h and lets arhictectures to define it.

It's clearer than defining ARCH_HAS_SG_CHAIN asm-generic/scatterlist.h
and undefing it in arhictectures that don't support it.

Signed-off-by: FUJITA Tomonori <[email protected]>
---
arch/alpha/include/asm/scatterlist.h | 4 +---
arch/arm/include/asm/scatterlist.h | 3 ---
arch/ia64/include/asm/scatterlist.h | 4 ++--
arch/microblaze/include/asm/scatterlist.h | 4 ++--
arch/powerpc/include/asm/scatterlist.h | 1 +
arch/sparc/include/asm/scatterlist.h | 5 +++--
arch/x86/include/asm/scatterlist.h | 5 +++--
include/asm-generic/scatterlist.h | 2 --
8 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/arch/alpha/include/asm/scatterlist.h b/arch/alpha/include/asm/scatterlist.h
index 85a0ef2..5728c52 100644
--- a/arch/alpha/include/asm/scatterlist.h
+++ b/arch/alpha/include/asm/scatterlist.h
@@ -1,10 +1,8 @@
#ifndef _ALPHA_SCATTERLIST_H
#define _ALPHA_SCATTERLIST_H

-#define ISA_DMA_THRESHOLD (~0UL)
-
#include <asm-generic/scatterlist.h>

-#undef ARCH_HAS_SG_CHAIN
+#define ISA_DMA_THRESHOLD (~0UL)

#endif /* !(_ALPHA_SCATTERLIST_H) */
diff --git a/arch/arm/include/asm/scatterlist.h b/arch/arm/include/asm/scatterlist.h
index bcda59f..2f87870 100644
--- a/arch/arm/include/asm/scatterlist.h
+++ b/arch/arm/include/asm/scatterlist.h
@@ -3,9 +3,6 @@

#include <asm/memory.h>
#include <asm/types.h>
-
#include <asm-generic/scatterlist.h>

-#undef ARCH_HAS_SG_CHAIN
-
#endif /* _ASMARM_SCATTERLIST_H */
diff --git a/arch/ia64/include/asm/scatterlist.h b/arch/ia64/include/asm/scatterlist.h
index d8e9896..f299a4f 100644
--- a/arch/ia64/include/asm/scatterlist.h
+++ b/arch/ia64/include/asm/scatterlist.h
@@ -1,6 +1,7 @@
#ifndef _ASM_IA64_SCATTERLIST_H
#define _ASM_IA64_SCATTERLIST_H

+#include <asm-generic/scatterlist.h>
/*
* It used to be that ISA_DMA_THRESHOLD had something to do with the
* DMA-limits of ISA-devices. Nowadays, its only remaining use (apart
@@ -10,7 +11,6 @@
* that's 4GB - 1.
*/
#define ISA_DMA_THRESHOLD 0xffffffff
-
-#include <asm-generic/scatterlist.h>
+#define ARCH_HAS_SG_CHAIN

#endif /* _ASM_IA64_SCATTERLIST_H */
diff --git a/arch/microblaze/include/asm/scatterlist.h b/arch/microblaze/include/asm/scatterlist.h
index be44d94..dc4a890 100644
--- a/arch/microblaze/include/asm/scatterlist.h
+++ b/arch/microblaze/include/asm/scatterlist.h
@@ -1,3 +1,3 @@
-#define ISA_DMA_THRESHOLD (~0UL)
-
#include <asm-generic/scatterlist.h>
+
+#define ISA_DMA_THRESHOLD (~0UL)
diff --git a/arch/powerpc/include/asm/scatterlist.h b/arch/powerpc/include/asm/scatterlist.h
index 4ae35da..34cc78f 100644
--- a/arch/powerpc/include/asm/scatterlist.h
+++ b/arch/powerpc/include/asm/scatterlist.h
@@ -15,5 +15,6 @@
#ifdef __powerpc64__
#define ISA_DMA_THRESHOLD (~0UL)
#endif
+#define ARCH_HAS_SG_CHAIN

#endif /* _ASM_POWERPC_SCATTERLIST_H */
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
index 69d21bb..433e45f 100644
--- a/arch/sparc/include/asm/scatterlist.h
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -1,8 +1,9 @@
#ifndef _SPARC_SCATTERLIST_H
#define _SPARC_SCATTERLIST_H

-#define ISA_DMA_THRESHOLD (~0UL)
-
#include <asm-generic/scatterlist.h>

+#define ISA_DMA_THRESHOLD (~0UL)
+#define ARCH_HAS_SG_CHAIN
+
#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/x86/include/asm/scatterlist.h b/arch/x86/include/asm/scatterlist.h
index 75af592..fb0b187 100644
--- a/arch/x86/include/asm/scatterlist.h
+++ b/arch/x86/include/asm/scatterlist.h
@@ -1,8 +1,9 @@
#ifndef _ASM_X86_SCATTERLIST_H
#define _ASM_X86_SCATTERLIST_H

-#define ISA_DMA_THRESHOLD (0x00ffffff)
-
#include <asm-generic/scatterlist.h>

+#define ISA_DMA_THRESHOLD (0x00ffffff)
+#define ARCH_HAS_SG_CHAIN
+
#endif /* _ASM_X86_SCATTERLIST_H */
diff --git a/include/asm-generic/scatterlist.h b/include/asm-generic/scatterlist.h
index 5e08794..5de0735 100644
--- a/include/asm-generic/scatterlist.h
+++ b/include/asm-generic/scatterlist.h
@@ -31,6 +31,4 @@ struct scatterlist {
#define sg_dma_len(sg) ((sg)->length)
#endif

-#define ARCH_HAS_SG_CHAIN
-
#endif /* __ASM_GENERIC_SCATTERLIST_H */
--
1.7.0

2010-04-05 23:55:05

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 08/12] xtensa: use use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Chris Zankel <[email protected]>
---
arch/xtensa/include/asm/scatterlist.h | 23 +----------------------
1 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/arch/xtensa/include/asm/scatterlist.h b/arch/xtensa/include/asm/scatterlist.h
index 810080b..b1f9fdc 100644
--- a/arch/xtensa/include/asm/scatterlist.h
+++ b/arch/xtensa/include/asm/scatterlist.h
@@ -11,28 +11,7 @@
#ifndef _XTENSA_SCATTERLIST_H
#define _XTENSA_SCATTERLIST_H

-#include <asm/types.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- unsigned int offset;
- dma_addr_t dma_address;
- unsigned int length;
-};
-
-/*
- * These macros should be used after a pci_map_sg call has been done
- * to get bus addresses of each of the SG entries and their lengths.
- * You should only work with the number of sg entries pci_map_sg
- * returns, or alternatively stop on the first sg_dma_len(sg) which
- * is 0.
- */
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
-
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (~0UL)

--
1.7.0

2010-04-05 23:55:12

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 02/12] avr32: use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Haavard Skinnemoen <[email protected]>
---
arch/avr32/include/asm/scatterlist.h | 20 +-------------------
1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/arch/avr32/include/asm/scatterlist.h b/arch/avr32/include/asm/scatterlist.h
index 377320e..06394e5 100644
--- a/arch/avr32/include/asm/scatterlist.h
+++ b/arch/avr32/include/asm/scatterlist.h
@@ -1,25 +1,7 @@
#ifndef __ASM_AVR32_SCATTERLIST_H
#define __ASM_AVR32_SCATTERLIST_H

-#include <asm/types.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- unsigned int offset;
- dma_addr_t dma_address;
- unsigned int length;
-};
-
-/* These macros should be used after a pci_map_sg call has been done
- * to get bus addresses of each of the SG entries and their lengths.
- * You should only work with the number of sg entries pci_map_sg
- * returns.
- */
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0xffffffff)

--
1.7.0

2010-04-05 23:54:58

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 05/12] m32r: use use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Hirokazu Takata <[email protected]>
---
arch/m32r/include/asm/scatterlist.h | 15 +--------------
1 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/arch/m32r/include/asm/scatterlist.h b/arch/m32r/include/asm/scatterlist.h
index 1ed372c..aeeddd8 100644
--- a/arch/m32r/include/asm/scatterlist.h
+++ b/arch/m32r/include/asm/scatterlist.h
@@ -1,20 +1,7 @@
#ifndef _ASM_M32R_SCATTERLIST_H
#define _ASM_M32R_SCATTERLIST_H

-#include <asm/types.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- char * address; /* Location data is to be transferred to, NULL for
- * highmem page */
- unsigned long page_link;
- unsigned int offset;/* for highmem, page offset */
-
- dma_addr_t dma_address;
- unsigned int length;
-};
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0x1fffffff)

--
1.7.0

2010-04-05 23:55:19

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 06/12] m68k: use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Roman Zippel <[email protected]>
---
arch/m68k/include/asm/scatterlist.h | 16 +---------------
1 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/arch/m68k/include/asm/scatterlist.h b/arch/m68k/include/asm/scatterlist.h
index e27ad90..175da06 100644
--- a/arch/m68k/include/asm/scatterlist.h
+++ b/arch/m68k/include/asm/scatterlist.h
@@ -1,23 +1,9 @@
#ifndef _M68K_SCATTERLIST_H
#define _M68K_SCATTERLIST_H

-#include <linux/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; /* A place to hang host-specific addresses at. */
-};
+#include <asm-generic/scatterlist.h>

/* This is bogus and should go away. */
#define ISA_DMA_THRESHOLD (0x00ffffff)

-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
-
#endif /* !(_M68K_SCATTERLIST_H) */
--
1.7.0

2010-04-05 23:55:29

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 09/12] blackfin: use use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Mike Frysinger <[email protected]>
---
arch/blackfin/include/asm/scatterlist.h | 22 +---------------------
1 files changed, 1 insertions(+), 21 deletions(-)

diff --git a/arch/blackfin/include/asm/scatterlist.h b/arch/blackfin/include/asm/scatterlist.h
index 04f4487..64d41d3 100644
--- a/arch/blackfin/include/asm/scatterlist.h
+++ b/arch/blackfin/include/asm/scatterlist.h
@@ -1,27 +1,7 @@
#ifndef _BLACKFIN_SCATTERLIST_H
#define _BLACKFIN_SCATTERLIST_H

-#include <linux/mm.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- unsigned int offset;
- dma_addr_t dma_address;
- unsigned int length;
-};
-
-/*
- * These macros should be used after a pci_map_sg call has been done
- * to get bus addresses of each of the SG entries and their lengths.
- * You should only work with the number of sg entries pci_map_sg
- * returns, or alternatively stop on the first sg_dma_len(sg) which
- * is 0.
- */
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0xffffffff)

--
1.7.0

2010-04-05 23:55:35

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 11/12] mn10300: use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: David Howells <[email protected]>
Cc: Koichi Yasutake <[email protected]>
---
arch/mn10300/include/asm/scatterlist.h | 39 +-------------------------------
1 files changed, 1 insertions(+), 38 deletions(-)

diff --git a/arch/mn10300/include/asm/scatterlist.h b/arch/mn10300/include/asm/scatterlist.h
index 6753590..7bd00b9 100644
--- a/arch/mn10300/include/asm/scatterlist.h
+++ b/arch/mn10300/include/asm/scatterlist.h
@@ -11,45 +11,8 @@
#ifndef _ASM_SCATTERLIST_H
#define _ASM_SCATTERLIST_H

-#include <asm/types.h>
-
-/*
- * Drivers must set either ->address or (preferred) page and ->offset
- * to indicate where data must be transferred to/from.
- *
- * Using page is recommended since it handles highmem data as well as
- * low mem. ->address is restricted to data which has a virtual mapping, and
- * it will go away in the future. Updating to page can be automated very
- * easily -- something like
- *
- * sg->address = some_ptr;
- *
- * can be rewritten as
- *
- * sg_set_page(virt_to_page(some_ptr));
- * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK;
- *
- * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
- */
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- unsigned int offset; /* for highmem, page offset */
- dma_addr_t dma_address;
- unsigned int length;
-};
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0x00ffffff)

-/*
- * These macros should be used after a pci_map_sg call has been done
- * to get bus addresses of each of the SG entries and their lengths.
- * You should only work with the number of sg entries pci_map_sg
- * returns.
- */
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
-
#endif /* _ASM_SCATTERLIST_H */
--
1.7.0

2010-04-05 23:55:58

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 12/12] parisc: use asm-generic/scatterlist.h

parisc uses iova and iova_length in scatterlist structure instead of
dma_address and dma_length. However, the accessor are used so we can
convert parisc to use asm-generic/scatterlist.h easily.

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
---
arch/parisc/Kconfig | 3 +++
arch/parisc/include/asm/scatterlist.h | 20 ++------------------
2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index f467a9d..907417d 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -94,6 +94,9 @@ config STACKTRACE_SUPPORT
config NEED_DMA_MAP_STATE
def_bool y

+config NEED_SG_DMA_LENGTH
+ def_bool y
+
config ISA_DMA_API
bool

diff --git a/arch/parisc/include/asm/scatterlist.h b/arch/parisc/include/asm/scatterlist.h
index 62269b3..2c3b79b 100644
--- a/arch/parisc/include/asm/scatterlist.h
+++ b/arch/parisc/include/asm/scatterlist.h
@@ -3,25 +3,9 @@

#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;
-
- /* an IOVA can be 64-bits on some PA-Risc platforms. */
- dma_addr_t iova; /* I/O Virtual Address */
- __u32 iova_length; /* bytes mapped */
-};
-
-#define sg_virt_addr(sg) ((unsigned long)sg_virt(sg))
-#define sg_dma_address(sg) ((sg)->iova)
-#define sg_dma_len(sg) ((sg)->iova_length)
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (~0UL)
+#define sg_virt_addr(sg) ((unsigned long)sg_virt(sg))

#endif /* _ASM_PARISC_SCATTERLIST_H */
--
1.7.0

2010-04-05 23:56:10

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 10/12] frv: use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: David Howells <[email protected]>
---
arch/frv/include/asm/scatterlist.h | 40 +-----------------------------------
1 files changed, 1 insertions(+), 39 deletions(-)

diff --git a/arch/frv/include/asm/scatterlist.h b/arch/frv/include/asm/scatterlist.h
index 4bca8a2..1614bfd 100644
--- a/arch/frv/include/asm/scatterlist.h
+++ b/arch/frv/include/asm/scatterlist.h
@@ -1,45 +1,7 @@
#ifndef _ASM_SCATTERLIST_H
#define _ASM_SCATTERLIST_H

-#include <asm/types.h>
-
-/*
- * Drivers must set either ->address or (preferred) page and ->offset
- * to indicate where data must be transferred to/from.
- *
- * Using page is recommended since it handles highmem data as well as
- * low mem. ->address is restricted to data which has a virtual mapping, and
- * it will go away in the future. Updating to page can be automated very
- * easily -- something like
- *
- * sg->address = some_ptr;
- *
- * can be rewritten as
- *
- * sg_set_buf(sg, some_ptr, length);
- *
- * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
- */
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- unsigned int offset; /* for highmem, page offset */
-
- dma_addr_t dma_address;
- unsigned int length;
-};
-
-/*
- * These macros should be used after a pci_map_sg call has been done
- * to get bus addresses of each of the SG entries and their lengths.
- * You should only work with the number of sg entries pci_map_sg
- * returns, or alternatively stop on the first sg_dma_len(sg) which
- * is 0.
- */
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0xffffffffUL)

--
1.7.0

2010-04-05 23:56:19

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 04/12] h8300: use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Yoshinori Sato <[email protected]>
---
arch/h8300/include/asm/scatterlist.h | 12 +-----------
1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/arch/h8300/include/asm/scatterlist.h b/arch/h8300/include/asm/scatterlist.h
index d3ecdd8..de08a4a 100644
--- a/arch/h8300/include/asm/scatterlist.h
+++ b/arch/h8300/include/asm/scatterlist.h
@@ -1,17 +1,7 @@
#ifndef _H8300_SCATTERLIST_H
#define _H8300_SCATTERLIST_H

-#include <asm/types.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- unsigned int offset;
- dma_addr_t dma_address;
- unsigned int length;
-};
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0xffffffff)

--
1.7.0

2010-04-05 23:56:28

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 03/12] cris: use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Mikael Starvik <[email protected]>
Cc: Jesper Nilsson <[email protected]>
---
arch/cris/include/asm/scatterlist.h | 17 +----------------
1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/arch/cris/include/asm/scatterlist.h b/arch/cris/include/asm/scatterlist.h
index faff53a..249a784 100644
--- a/arch/cris/include/asm/scatterlist.h
+++ b/arch/cris/include/asm/scatterlist.h
@@ -1,22 +1,7 @@
#ifndef __ASM_CRIS_SCATTERLIST_H
#define __ASM_CRIS_SCATTERLIST_H

-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- char * address; /* Location data is to be transferred to */
- unsigned int length;
-
- /* The following is i386 highmem junk - not used by us */
- unsigned long page_link;
- unsigned int offset;/* for highmem, page offset */
-
-};
-
-#define sg_dma_address(sg) ((sg)->address)
-#define sg_dma_len(sg) ((sg)->length)
-/* i386 junk */
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0x1fffffff)

--
1.7.0

2010-04-05 23:56:52

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH -mm 07/12] mips: use use asm-generic/scatterlist.h

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Ralf Baechle <[email protected]>
---
arch/mips/include/asm/scatterlist.h | 22 +---------------------
1 files changed, 1 insertions(+), 21 deletions(-)

diff --git a/arch/mips/include/asm/scatterlist.h b/arch/mips/include/asm/scatterlist.h
index 83d69fe..9af65e7 100644
--- a/arch/mips/include/asm/scatterlist.h
+++ b/arch/mips/include/asm/scatterlist.h
@@ -1,27 +1,7 @@
#ifndef __ASM_SCATTERLIST_H
#define __ASM_SCATTERLIST_H

-#include <asm/types.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- unsigned int offset;
- dma_addr_t dma_address;
- unsigned int length;
-};
-
-/*
- * These macros should be used after a pci_map_sg call has been done
- * to get bus addresses of each of the SG entries and their lengths.
- * You should only work with the number of sg entries pci_map_sg
- * returns, or alternatively stop on the first sg_dma_len(sg) which
- * is 0.
- */
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
+#include <asm-generic/scatterlist.h>

#define ISA_DMA_THRESHOLD (0x00ffffffUL)

--
1.7.0

2010-04-06 14:12:37

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: [PATCH -mm 02/12] avr32: use asm-generic/scatterlist.h

FUJITA Tomonori <[email protected]> wrote:
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Cc: Haavard Skinnemoen <[email protected]>

It's a bit difficult to review without context, but assuming this
doesn't make struct scatterlist any larger:

Acked-by: Haavard Skinnemoen <[email protected]>

2010-04-06 23:55:59

by FUJITA Tomonori

[permalink] [raw]
Subject: Re: [PATCH -mm 02/12] avr32: use asm-generic/scatterlist.h

On Tue, 6 Apr 2010 15:38:08 +0200
Haavard Skinnemoen <[email protected]> wrote:

> FUJITA Tomonori <[email protected]> wrote:
> > Signed-off-by: FUJITA Tomonori <[email protected]>
> > Cc: Haavard Skinnemoen <[email protected]>
>
> It's a bit difficult to review without context, but assuming this
> doesn't make struct scatterlist any larger:
>
> Acked-by: Haavard Skinnemoen <[email protected]>

Thanks!

Yeah, the size of struct scatterlist doesn't change. You can find
asm-generic/scatterlist.h in my patchset:

http://git.kernel.org/?p=linux/kernel/git/tomo/linux-2.6-misc.git;a=blob;f=include/asm-generic/scatterlist.h;h=5de07355fad492b10b15227e7959f7cc08e6b044;hb=refs/heads/sc

2010-04-08 03:51:27

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH -mm 09/12] blackfin: use use asm-generic/scatterlist.h

On Mon, Apr 5, 2010 at 19:52, FUJITA Tomonori wrote:
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Cc: Mike Frysinger <[email protected]>
> ---
>  arch/blackfin/include/asm/scatterlist.h |   22 +---------------------
>  1 files changed, 1 insertions(+), 21 deletions(-)
>
> diff --git a/arch/blackfin/include/asm/scatterlist.h b/arch/blackfin/include/asm/scatterlist.h
> index 04f4487..64d41d3 100644
> --- a/arch/blackfin/include/asm/scatterlist.h
> +++ b/arch/blackfin/include/asm/scatterlist.h
> @@ -1,27 +1,7 @@
>  #ifndef _BLACKFIN_SCATTERLIST_H
>  #define _BLACKFIN_SCATTERLIST_H
>
> -#include <linux/mm.h>
> -
> -struct scatterlist {
> -#ifdef CONFIG_DEBUG_SG
> -       unsigned long sg_magic;
> -#endif
> -       unsigned long page_link;
> -       unsigned int offset;
> -       dma_addr_t dma_address;
> -       unsigned int length;
> -};
> -
> -/*
> - * These macros should be used after a pci_map_sg call has been done
> - * to get bus addresses of each of the SG entries and their lengths.
> - * You should only work with the number of sg entries pci_map_sg
> - * returns, or alternatively stop on the first sg_dma_len(sg) which
> - * is 0.
> - */
> -#define sg_dma_address(sg)      ((sg)->dma_address)
> -#define sg_dma_len(sg)          ((sg)->length)
> +#include <asm-generic/scatterlist.h>
>
>  #define ISA_DMA_THRESHOLD      (0xffffffff)

this is the same value as the common asm-generic one, so this define
should be punted, especially since this would probably introduce
redefined warnings.

once that is done, this header is simply a redirect, so it'd be better
if it was just one line:
#include <asm-generic/scatterlist.h>

one of the reasons i hadnt converted sooner was that it seems like the
common header introduces bloat. the Blackfin header has just "length"
while the asm-generic has both "length" and "dma_length". unless i
missed something, this hasnt been a problem for us. perhaps the
common header should have something like:
#if __BITS_PER_LONG == 64
unsigned int dma_length;
#endif
this would match the existing sg_dma_len code. or perhaps declare the
two lengths as an anonymous union.
-mike

2010-04-08 05:00:33

by FUJITA Tomonori

[permalink] [raw]
Subject: Re: [PATCH -mm 09/12] blackfin: use use asm-generic/scatterlist.h

On Wed, 7 Apr 2010 23:51:04 -0400
Mike Frysinger <[email protected]> wrote:

> > #define ISA_DMA_THRESHOLD (0xffffffff)
>
> this is the same value as the common asm-generic one, so this define
> should be punted, especially since this would probably introduce
> redefined warnings.

I removed ISA_DMA_THRESHOLD in the common asm-generic one since it
doesn't work for powerpc.

I've attached the common asm-generic in -mm below.

> once that is done, this header is simply a redirect, so it'd be better
> if it was just one line:
> #include <asm-generic/scatterlist.h>
>
> one of the reasons i hadnt converted sooner was that it seems like the
> common header introduces bloat. the Blackfin header has just "length"

I took care of it. Blackfin doesn't define
CONFIG_NEED_SG_DMA_LENGTH so doesn't get "dma_length".


> while the asm-generic has both "length" and "dma_length". unless i
> missed something, this hasnt been a problem for us. perhaps the
> common header should have something like:
> #if __BITS_PER_LONG == 64
> unsigned int dma_length;
> #endif

'#if __BITS_PER_LONG == 64' doesn't work since some 32-bit
architectures need it. So I invented CONFIG_NEED_SG_DMA_LENGTH.

=
#ifndef __ASM_GENERIC_SCATTERLIST_H
#define __ASM_GENERIC_SCATTERLIST_H

#include <linux/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;
#ifdef CONFIG_NEED_SG_DMA_LENGTH
unsigned int dma_length;
#endif
};

/*
* These macros should be used after a dma_map_sg call has been done
* to get bus addresses of each of the SG entries and their lengths.
* You should only work with the number of sg entries pci_map_sg
* returns, or alternatively stop on the first sg_dma_len(sg) which
* is 0.
*/
#define sg_dma_address(sg) ((sg)->dma_address)

#ifdef CONFIG_NEED_SG_DMA_LENGTH
#define sg_dma_len(sg) ((sg)->dma_length)
#else
#define sg_dma_len(sg) ((sg)->length)
#endif

#endif /* __ASM_GENERIC_SCATTERLIST_H */

2010-04-23 08:29:13

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH -mm 06/12] m68k: use asm-generic/scatterlist.h

On Tue, Apr 6, 2010 at 01:52, FUJITA Tomonori
<[email protected]> wrote:
> Signed-off-by: FUJITA Tomonori <[email protected]>
> Cc: Geert Uytterhoeven <[email protected]>
> Cc: Roman Zippel <[email protected]>
> ---
>  arch/m68k/include/asm/scatterlist.h |   16 +---------------
>  1 files changed, 1 insertions(+), 15 deletions(-)
>
> diff --git a/arch/m68k/include/asm/scatterlist.h b/arch/m68k/include/asm/scatterlist.h
> index e27ad90..175da06 100644
> --- a/arch/m68k/include/asm/scatterlist.h
> +++ b/arch/m68k/include/asm/scatterlist.h
> @@ -1,23 +1,9 @@
>  #ifndef _M68K_SCATTERLIST_H
>  #define _M68K_SCATTERLIST_H
>
> -#include <linux/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; /* A place to hang host-specific addresses at. */
> -};
> +#include <asm-generic/scatterlist.h>

This include should be ...

>  /* This is bogus and should go away. */
>  #define ISA_DMA_THRESHOLD (0x00ffffff)

... below this definition, else you get duplicate definition errors
(and the wrong definition).

> -#define sg_dma_address(sg)     ((sg)->dma_address)
> -#define sg_dma_len(sg)         ((sg)->length)
> -
>  #endif /* !(_M68K_SCATTERLIST_H) */
> --
> 1.7.0

Will apply (incl. the fix).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2010-04-25 13:46:59

by FUJITA Tomonori

[permalink] [raw]
Subject: Re: [PATCH -mm 06/12] m68k: use asm-generic/scatterlist.h

On Fri, 23 Apr 2010 10:29:04 +0200
Geert Uytterhoeven <[email protected]> wrote:

> > +#include <asm-generic/scatterlist.h>
>
> This include should be ...
>
> > /* This is bogus and should go away. */
> > #define ISA_DMA_THRESHOLD (0x00ffffff)

asm-generic/scatterlist.h can't define ISA_DMA_THRESHOLD because of
the way POWERPC uses ISA_DMA_THRESHOLD.


> ... below this definition, else you get duplicate definition errors
> (and the wrong definition).
>
> > -#define sg_dma_address(sg) ((sg)->dma_address)
> > -#define sg_dma_len(sg) ((sg)->length)

This patch needs to be applied against -mm; including some changes to
asm-generic/scatterlist.h.

I've attached asm-generic/scatterlist.h in -mm.

=
#ifndef __ASM_GENERIC_SCATTERLIST_H
#define __ASM_GENERIC_SCATTERLIST_H

#include <linux/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;
#ifdef CONFIG_NEED_SG_DMA_LENGTH
unsigned int dma_length;
#endif
};

/*
* These macros should be used after a dma_map_sg call has been done
* to get bus addresses of each of the SG entries and their lengths.
* You should only work with the number of sg entries pci_map_sg
* returns, or alternatively stop on the first sg_dma_len(sg) which
* is 0.
*/
#define sg_dma_address(sg) ((sg)->dma_address)

#ifdef CONFIG_NEED_SG_DMA_LENGTH
#define sg_dma_len(sg) ((sg)->dma_length)
#else
#define sg_dma_len(sg) ((sg)->length)
#endif

#endif /* __ASM_GENERIC_SCATTERLIST_H */

2010-04-25 18:17:37

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH -mm 06/12] m68k: use asm-generic/scatterlist.h

On Sun, Apr 25, 2010 at 15:46, FUJITA Tomonori
<[email protected]> wrote:
> On Fri, 23 Apr 2010 10:29:04 +0200
> Geert Uytterhoeven <[email protected]> wrote:
>
>> > +#include <asm-generic/scatterlist.h>
>>
>> This include should be ...
>>
>> > /* This is bogus and should go away. */
>> > #define ISA_DMA_THRESHOLD (0x00ffffff)
>
> asm-generic/scatterlist.h can't define ISA_DMA_THRESHOLD because of
> the way POWERPC uses ISA_DMA_THRESHOLD.
>
>
>> ... below this definition, else you get duplicate definition errors
>> (and the wrong definition).
>>
>> > -#define sg_dma_address(sg) ((sg)->dma_address)
>> > -#define sg_dma_len(sg) ((sg)->length)
>
> This patch needs to be applied against -mm; including some changes to
> asm-generic/scatterlist.h.

Ah, sorry, I thought it was against mainline.

> I've attached asm-generic/scatterlist.h in -mm.
>
> =
> #ifndef __ASM_GENERIC_SCATTERLIST_H
> #define __ASM_GENERIC_SCATTERLIST_H
>
> #include <linux/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;
> #ifdef CONFIG_NEED_SG_DMA_LENGTH
>        unsigned int    dma_length;
> #endif
> };
>
> /*
>  * These macros should be used after a dma_map_sg call has been done
>  * to get bus addresses of each of the SG entries and their lengths.
>  * You should only work with the number of sg entries pci_map_sg
>  * returns, or alternatively stop on the first sg_dma_len(sg) which
>  * is 0.
>  */
> #define sg_dma_address(sg)      ((sg)->dma_address)
>
> #ifdef CONFIG_NEED_SG_DMA_LENGTH
> #define sg_dma_len(sg)          ((sg)->dma_length)
> #else
> #define sg_dma_len(sg)          ((sg)->length)
> #endif
>
> #endif /* __ASM_GENERIC_SCATTERLIST_H */

OK, I won't touch it.

Please consider it acked-by, so it can go in through Andrew, together with
the other patches.

Sorry for the confusion.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds