diff mbox series

[1/9] dma-mapping: fix the prototype of dma_map_single()

Message ID 20200204110906.9377-2-yamada.masahiro@socionext.com
State Superseded
Headers show
Series mmc: sdhci: code clean-up and fix cache coherency problem. | expand

Commit Message

Masahiro Yamada Feb. 4, 2020, 11:08 a.m. UTC
Make dma_map_single() return the dma address, and remove the
pointless volatile.

Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---

 arch/arm/include/asm/dma-mapping.h   | 5 +++--
 arch/nds32/include/asm/dma-mapping.h | 5 +++--
 arch/riscv/include/asm/dma-mapping.h | 5 +++--
 arch/x86/include/asm/dma-mapping.h   | 5 +++--
 4 files changed, 12 insertions(+), 8 deletions(-)

Comments

Simon Glass Feb. 5, 2020, 12:16 a.m. UTC | #1
On Tue, 4 Feb 2020 at 04:09, Masahiro Yamada
<yamada.masahiro at socionext.com> wrote:
>
> Make dma_map_single() return the dma address, and remove the
> pointless volatile.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> ---
>
>  arch/arm/include/asm/dma-mapping.h   | 5 +++--
>  arch/nds32/include/asm/dma-mapping.h | 5 +++--
>  arch/riscv/include/asm/dma-mapping.h | 5 +++--
>  arch/x86/include/asm/dma-mapping.h   | 5 +++--
>  4 files changed, 12 insertions(+), 8 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

But please can you add a full function comment in the header files?
Rick Chen Feb. 6, 2020, 1:16 a.m. UTC | #2
> From: Masahiro Yamada [mailto:yamada.masahiro at socionext.com]
> Sent: Tuesday, February 04, 2020 7:09 PM
> To: u-boot at lists.denx.de
> Cc: Masahiro Yamada; Bin Meng; Rick Jian-Zhi Chen(陳建志); Simon Glass
> Subject: [PATCH 1/9] dma-mapping: fix the prototype of dma_map_single()
>
> Make dma_map_single() return the dma address, and remove the pointless volatile.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>

Reviewed-by: Rick Chen <rick at andestech.com>

> ---
>
>  arch/arm/include/asm/dma-mapping.h   | 5 +++--
>  arch/nds32/include/asm/dma-mapping.h | 5 +++--  arch/riscv/include/asm/dma-mapping.h | 5 +++--
>  arch/x86/include/asm/dma-mapping.h   | 5 +++--
>  4 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> index d20703739fad..d0895a209666 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -11,6 +11,7 @@
>  #include <asm/cache.h>
>  #include <cpu_func.h>
>  #include <linux/dma-direction.h>
> +#include <linux/types.h>
>  #include <malloc.h>
>
>  #define        dma_mapping_error(x, y) 0
> @@ -26,8 +27,8 @@ static inline void dma_free_coherent(void *addr)
>         free(addr);
>  }
>
> -static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
> -                                          enum dma_data_direction dir)
> +static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
> +                                       enum dma_data_direction dir)
>  {
>         unsigned long addr = (unsigned long)vaddr;
>
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> index c8876ceadda6..9387dec34768 100644
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ b/arch/nds32/include/asm/dma-mapping.h
> @@ -10,6 +10,7 @@
>  #include <asm/cache.h>
>  #include <cpu_func.h>
>  #include <linux/dma-direction.h>
> +#include <linux/types.h>
>  #include <malloc.h>
>
>  static void *dma_alloc_coherent(size_t len, unsigned long *handle) @@ -18,8 +19,8 @@ static void *dma_alloc_coherent(size_t len, unsigned long *handle)
>         return (void *)*handle;
>  }
>
> -static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
> -                                          enum dma_data_direction dir)
> +static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
> +                                       enum dma_data_direction dir)
>  {
>         unsigned long addr = (unsigned long)vaddr;
>
> diff --git a/arch/riscv/include/asm/dma-mapping.h b/arch/riscv/include/asm/dma-mapping.h
> index 6cc39469590a..eac56f8fbdfa 100644
> --- a/arch/riscv/include/asm/dma-mapping.h
> +++ b/arch/riscv/include/asm/dma-mapping.h
> @@ -10,6 +10,7 @@
>  #define __ASM_RISCV_DMA_MAPPING_H
>
>  #include <common.h>
> +#include <linux/types.h>
>  #include <asm/cache.h>
>  #include <cpu_func.h>
>  #include <linux/dma-direction.h>
> @@ -28,8 +29,8 @@ static inline void dma_free_coherent(void *addr)
>         free(addr);
>  }
>
> -static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
> -                                          enum dma_data_direction dir)
> +static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
> +                                       enum dma_data_direction dir)
>  {
>         unsigned long addr = (unsigned long)vaddr;
>
> diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
> index 900b99b8a69a..7e205e3313ac 100644
> --- a/arch/x86/include/asm/dma-mapping.h
> +++ b/arch/x86/include/asm/dma-mapping.h
> @@ -11,6 +11,7 @@
>  #include <asm/cache.h>
>  #include <cpu_func.h>
>  #include <linux/dma-direction.h>
> +#include <linux/types.h>
>  #include <malloc.h>
>
>  #define        dma_mapping_error(x, y) 0
> @@ -26,8 +27,8 @@ static inline void dma_free_coherent(void *addr)
>         free(addr);
>  }
>
> -static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
> -                                          enum dma_data_direction dir)
> +static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
> +                                       enum dma_data_direction dir)
>  {
>         unsigned long addr = (unsigned long)vaddr;
>
> --
> 2.17.1
>
Masahiro Yamada Feb. 11, 2020, 3:18 p.m. UTC | #3
Hi Simon,

On Wed, Feb 5, 2020 at 9:17 AM Simon Glass <sjg at chromium.org> wrote:
>
> On Tue, 4 Feb 2020 at 04:09, Masahiro Yamada
> <yamada.masahiro at socionext.com> wrote:
> >
> > Make dma_map_single() return the dma address, and remove the
> > pointless volatile.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> > ---
> >
> >  arch/arm/include/asm/dma-mapping.h   | 5 +++--
> >  arch/nds32/include/asm/dma-mapping.h | 5 +++--
> >  arch/riscv/include/asm/dma-mapping.h | 5 +++--
> >  arch/x86/include/asm/dma-mapping.h   | 5 +++--
> >  4 files changed, 12 insertions(+), 8 deletions(-)
>
> Reviewed-by: Simon Glass <sjg at chromium.org>
>
> But please can you add a full function comment in the header files?


I can comment them, but it is tedious to duplicate
exactly the same description to all of these architectures.

So, my next plan is to merge them into
include/asm-generic/dma-mapping.h,
then make it a single point of comments.

Each arch's <asm/dma-mapping.h> can simply wraps
<asm-generic/dma-mapping.h>

It would be beyond the scope of this series
(since my main motivation is fix the mmc/sdhci bug).

So, I want to just let this series go in.

After it lands, I can factoring them out,
and add some comments.
Simon Glass Feb. 11, 2020, 5:14 p.m. UTC | #4
On Tue, 11 Feb 2020 at 08:19, Masahiro Yamada <masahiroy at kernel.org> wrote:
>
> Hi Simon,
>
> On Wed, Feb 5, 2020 at 9:17 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > On Tue, 4 Feb 2020 at 04:09, Masahiro Yamada
> > <yamada.masahiro at socionext.com> wrote:
> > >
> > > Make dma_map_single() return the dma address, and remove the
> > > pointless volatile.
> > >
> > > Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
> > > ---
> > >
> > >  arch/arm/include/asm/dma-mapping.h   | 5 +++--
> > >  arch/nds32/include/asm/dma-mapping.h | 5 +++--
> > >  arch/riscv/include/asm/dma-mapping.h | 5 +++--
> > >  arch/x86/include/asm/dma-mapping.h   | 5 +++--
> > >  4 files changed, 12 insertions(+), 8 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> > But please can you add a full function comment in the header files?
>
>
> I can comment them, but it is tedious to duplicate
> exactly the same description to all of these architectures.
>
> So, my next plan is to merge them into
> include/asm-generic/dma-mapping.h,
> then make it a single point of comments.
>
> Each arch's <asm/dma-mapping.h> can simply wraps
> <asm-generic/dma-mapping.h>
>
> It would be beyond the scope of this series
> (since my main motivation is fix the mmc/sdhci bug).
>
> So, I want to just let this series go in.
>
> After it lands, I can factoring them out,
> and add some comments.

OK sounds good.

BTW while I agree that duplicating comments is annoying, it's better
than not having comments.

Regards,
Simon
diff mbox series

Patch

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index d20703739fad..d0895a209666 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -11,6 +11,7 @@ 
 #include <asm/cache.h>
 #include <cpu_func.h>
 #include <linux/dma-direction.h>
+#include <linux/types.h>
 #include <malloc.h>
 
 #define	dma_mapping_error(x, y)	0
@@ -26,8 +27,8 @@  static inline void dma_free_coherent(void *addr)
 	free(addr);
 }
 
-static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
-					   enum dma_data_direction dir)
+static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
+					enum dma_data_direction dir)
 {
 	unsigned long addr = (unsigned long)vaddr;
 
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
index c8876ceadda6..9387dec34768 100644
--- a/arch/nds32/include/asm/dma-mapping.h
+++ b/arch/nds32/include/asm/dma-mapping.h
@@ -10,6 +10,7 @@ 
 #include <asm/cache.h>
 #include <cpu_func.h>
 #include <linux/dma-direction.h>
+#include <linux/types.h>
 #include <malloc.h>
 
 static void *dma_alloc_coherent(size_t len, unsigned long *handle)
@@ -18,8 +19,8 @@  static void *dma_alloc_coherent(size_t len, unsigned long *handle)
 	return (void *)*handle;
 }
 
-static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
-					   enum dma_data_direction dir)
+static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
+					enum dma_data_direction dir)
 {
 	unsigned long addr = (unsigned long)vaddr;
 
diff --git a/arch/riscv/include/asm/dma-mapping.h b/arch/riscv/include/asm/dma-mapping.h
index 6cc39469590a..eac56f8fbdfa 100644
--- a/arch/riscv/include/asm/dma-mapping.h
+++ b/arch/riscv/include/asm/dma-mapping.h
@@ -10,6 +10,7 @@ 
 #define __ASM_RISCV_DMA_MAPPING_H
 
 #include <common.h>
+#include <linux/types.h>
 #include <asm/cache.h>
 #include <cpu_func.h>
 #include <linux/dma-direction.h>
@@ -28,8 +29,8 @@  static inline void dma_free_coherent(void *addr)
 	free(addr);
 }
 
-static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
-					   enum dma_data_direction dir)
+static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
+					enum dma_data_direction dir)
 {
 	unsigned long addr = (unsigned long)vaddr;
 
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 900b99b8a69a..7e205e3313ac 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -11,6 +11,7 @@ 
 #include <asm/cache.h>
 #include <cpu_func.h>
 #include <linux/dma-direction.h>
+#include <linux/types.h>
 #include <malloc.h>
 
 #define	dma_mapping_error(x, y)	0
@@ -26,8 +27,8 @@  static inline void dma_free_coherent(void *addr)
 	free(addr);
 }
 
-static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
-					   enum dma_data_direction dir)
+static inline dma_addr_t dma_map_single(void *vaddr, size_t len,
+					enum dma_data_direction dir)
 {
 	unsigned long addr = (unsigned long)vaddr;