Linux-Renesas-SoC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH][repost] SH: compile fixup patches
@ 2020-01-09  0:26 Kuninori Morimoto
  2020-01-09  0:28 ` [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions Kuninori Morimoto
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-09  0:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Andrew Morton; +Cc: Linux-SH, Linux-Renesas


Hi Andrew, Yoshinori, Rich

I'm posting these patches to SH ML from few month/weeks ago,
but it seems SH maintainer is not working in these days...

I repost these again.
SH compile will be error without these patchese.

Thank you for your help !!
Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions
  2020-01-09  0:26 [PATCH][repost] SH: compile fixup patches Kuninori Morimoto
@ 2020-01-09  0:28 ` Kuninori Morimoto
  2020-01-09  0:28 ` [PATCH][repost] sh: clkfwk: remove r8/r16/r32 Kuninori Morimoto
  2020-01-09  0:30 ` [PATCH][repost] SH: Convert iounmap() macros to inline functions Kuninori Morimoto
  2 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-09  0:28 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Andrew Morton; +Cc: Linux-SH, Linux-Renesas


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Macro ins[bwl]/outs[bwl] are just calling BUG(), but that results in
unused variable warnings all over the place.
This patch convert macro to inline to avoid warning

We will get this kind of warning without this patch

	${LINUX}/drivers/iio/adc/ad7606_par.c:21:23: \
	  warning: unused variable 'st' [-Wunused-variable]
	struct ad7606_state *st = iio_priv(indio_dev);
	^~

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/sh/include/asm/io_noioport.h | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index 90d6109..f7938fe 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -53,12 +53,34 @@ static inline void ioport_unmap(void __iomem *addr)
 #define outw_p(x, addr)	outw((x), (addr))
 #define outl_p(x, addr)	outl((x), (addr))
 
-#define insb(a, b, c)	BUG()
-#define insw(a, b, c)	BUG()
-#define insl(a, b, c)	BUG()
+static inline void insb(unsigned long port, void *dst, unsigned long count)
+{
+	BUG();
+}
+
+static inline void insw(unsigned long port, void *dst, unsigned long count)
+{
+	BUG();
+}
+
+static inline void insl(unsigned long port, void *dst, unsigned long count)
+{
+	BUG();
+}
 
-#define outsb(a, b, c)	BUG()
-#define outsw(a, b, c)	BUG()
-#define outsl(a, b, c)	BUG()
+static inline void outsb(unsigned long port, const void *src, unsigned long count)
+{
+	BUG();
+}
+
+static inline void outsw(unsigned long port, const void *src, unsigned long count)
+{
+	BUG();
+}
+
+static inline void outsl(unsigned long port, const void *src, unsigned long count)
+{
+	BUG();
+}
 
 #endif /* __ASM_SH_IO_NOIOPORT_H */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH][repost] sh: clkfwk: remove r8/r16/r32
  2020-01-09  0:26 [PATCH][repost] SH: compile fixup patches Kuninori Morimoto
  2020-01-09  0:28 ` [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions Kuninori Morimoto
@ 2020-01-09  0:28 ` Kuninori Morimoto
  2020-01-09  8:18   ` Geert Uytterhoeven
  2020-01-09  0:30 ` [PATCH][repost] SH: Convert iounmap() macros to inline functions Kuninori Morimoto
  2 siblings, 1 reply; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-09  0:28 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Andrew Morton; +Cc: Linux-SH, Linux-Renesas


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

SH will get below warning

${LINUX}/drivers/sh/clk/cpg.c: In function 'r8':
${LINUX}/drivers/sh/clk/cpg.c:41:17: warning: passing argument 1 of 'ioread8'
 discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  return ioread8(addr);
                 ^~~~
In file included from ${LINUX}/arch/sh/include/asm/io.h:21,
                 from ${LINUX}/include/linux/io.h:13,
                 from ${LINUX}/drivers/sh/clk/cpg.c:14:
${LINUX}/include/asm-generic/iomap.h:29:29: note: expected 'void *' but
argument is of type 'const void *'
 extern unsigned int ioread8(void __iomem *);
                             ^~~~~~~~~~~~~~

We don't need "const" for r8/r16/r32.
And we don't need r8/r16/r32 themselvs.
This patch cleanup these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/sh/clk/cpg.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index eeb028b9..a5cacfe 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -36,36 +36,21 @@ static void sh_clk_write(int value, struct clk *clk)
 		iowrite32(value, clk->mapped_reg);
 }
 
-static unsigned int r8(const void __iomem *addr)
-{
-	return ioread8(addr);
-}
-
-static unsigned int r16(const void __iomem *addr)
-{
-	return ioread16(addr);
-}
-
-static unsigned int r32(const void __iomem *addr)
-{
-	return ioread32(addr);
-}
-
 static int sh_clk_mstp_enable(struct clk *clk)
 {
 	sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk);
 	if (clk->status_reg) {
-		unsigned int (*read)(const void __iomem *addr);
+		unsigned int (*read)(void __iomem *addr);
 		int i;
 		void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
 			(phys_addr_t)clk->enable_reg + clk->mapped_reg;
 
 		if (clk->flags & CLK_ENABLE_REG_8BIT)
-			read = r8;
+			read = ioread8;
 		else if (clk->flags & CLK_ENABLE_REG_16BIT)
-			read = r16;
+			read = ioread16;
 		else
-			read = r32;
+			read = ioread32;
 
 		for (i = 1000;
 		     (read(mapped_status) & (1 << clk->enable_bit)) && i;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH][repost] SH: Convert iounmap() macros to inline functions
  2020-01-09  0:26 [PATCH][repost] SH: compile fixup patches Kuninori Morimoto
  2020-01-09  0:28 ` [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions Kuninori Morimoto
  2020-01-09  0:28 ` [PATCH][repost] sh: clkfwk: remove r8/r16/r32 Kuninori Morimoto
@ 2020-01-09  0:30 ` Kuninori Morimoto
  2 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-09  0:30 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Andrew Morton; +Cc: Linux-SH, Linux-Renesas


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Macro iounmap() do nothing, but that results in
unused variable warnings all over the place.
This patch convert it to inline to avoid warning

We will get this warning without this patch

	${LINUX}/drivers/thermal/broadcom/ns-thermal.c:78:21: \
	  warning: unused variable 'ns_thermal' [-Wunused-variable]
	struct ns_thermal *ns_thermal = platform_get_drvdata(pdev);
	^~~~~~~~~~

Fixes: 98c90e5ea34e9 ("sh: remove __iounmap")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---
 arch/sh/include/asm/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 1495489..351a0a9 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -328,7 +328,7 @@ __ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot)
 #else
 #define __ioremap(offset, size, prot)		((void __iomem *)(offset))
 #define __ioremap_mode(offset, size, prot)	((void __iomem *)(offset))
-#define iounmap(addr)				do { } while (0)
+static inline void iounmap(void __iomem *addr) {}
 #endif /* CONFIG_MMU */
 
 static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][repost] sh: clkfwk: remove r8/r16/r32
  2020-01-09  0:28 ` [PATCH][repost] sh: clkfwk: remove r8/r16/r32 Kuninori Morimoto
@ 2020-01-09  8:18   ` Geert Uytterhoeven
  2020-01-10  0:13     ` Kuninori Morimoto
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2020-01-09  8:18 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Yoshinori Sato, Rich Felker, Andrew Morton, Linux-SH, Linux-Renesas

Hi Morimoto-san,

On Thu, Jan 9, 2020 at 1:29 AM Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> SH will get below warning
>
> ${LINUX}/drivers/sh/clk/cpg.c: In function 'r8':
> ${LINUX}/drivers/sh/clk/cpg.c:41:17: warning: passing argument 1 of 'ioread8'
>  discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>   return ioread8(addr);
>                  ^~~~
> In file included from ${LINUX}/arch/sh/include/asm/io.h:21,
>                  from ${LINUX}/include/linux/io.h:13,
>                  from ${LINUX}/drivers/sh/clk/cpg.c:14:
> ${LINUX}/include/asm-generic/iomap.h:29:29: note: expected 'void *' but
> argument is of type 'const void *'
>  extern unsigned int ioread8(void __iomem *);
>                              ^~~~~~~~~~~~~~
>
> We don't need "const" for r8/r16/r32.
> And we don't need r8/r16/r32 themselvs.
> This patch cleanup these.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

One note below.

> --- a/drivers/sh/clk/cpg.c
> +++ b/drivers/sh/clk/cpg.c
> @@ -36,36 +36,21 @@ static void sh_clk_write(int value, struct clk *clk)
>                 iowrite32(value, clk->mapped_reg);
>  }
>
> -static unsigned int r8(const void __iomem *addr)
> -{
> -       return ioread8(addr);
> -}
> -
> -static unsigned int r16(const void __iomem *addr)
> -{
> -       return ioread16(addr);
> -}
> -
> -static unsigned int r32(const void __iomem *addr)
> -{
> -       return ioread32(addr);
> -}
> -
>  static int sh_clk_mstp_enable(struct clk *clk)
>  {
>         sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk);
>         if (clk->status_reg) {
> -               unsigned int (*read)(const void __iomem *addr);
> +               unsigned int (*read)(void __iomem *addr);

While it is good to get rid of the wrappers, the change above will conflict with
[PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic
implementation)
(https://lore.kernel.org/lkml/20200108200528.4614-2-krzk@kernel.org/),
which will add const to ioread*().

>                 int i;
>                 void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
>                         (phys_addr_t)clk->enable_reg + clk->mapped_reg;
>
>                 if (clk->flags & CLK_ENABLE_REG_8BIT)
> -                       read = r8;
> +                       read = ioread8;
>                 else if (clk->flags & CLK_ENABLE_REG_16BIT)
> -                       read = r16;
> +                       read = ioread16;
>                 else
> -                       read = r32;
> +                       read = ioread32;
>
>                 for (i = 1000;
>                      (read(mapped_status) & (1 << clk->enable_bit)) && i;

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][repost] sh: clkfwk: remove r8/r16/r32
  2020-01-09  8:18   ` Geert Uytterhoeven
@ 2020-01-10  0:13     ` Kuninori Morimoto
  0 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-10  0:13 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Yoshinori Sato, Rich Felker, Andrew Morton, Linux-SH, Linux-Renesas


Hi Geert

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > SH will get below warning
> >
> > ${LINUX}/drivers/sh/clk/cpg.c: In function 'r8':
> > ${LINUX}/drivers/sh/clk/cpg.c:41:17: warning: passing argument 1 of 'ioread8'
> >  discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> >   return ioread8(addr);
> >                  ^~~~
> > In file included from ${LINUX}/arch/sh/include/asm/io.h:21,
> >                  from ${LINUX}/include/linux/io.h:13,
> >                  from ${LINUX}/drivers/sh/clk/cpg.c:14:
> > ${LINUX}/include/asm-generic/iomap.h:29:29: note: expected 'void *' but
> > argument is of type 'const void *'
> >  extern unsigned int ioread8(void __iomem *);
> >                              ^~~~~~~~~~~~~~
> >
> > We don't need "const" for r8/r16/r32.
> > And we don't need r8/r16/r32 themselvs.
> > This patch cleanup these.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks

> >  static int sh_clk_mstp_enable(struct clk *clk)
> >  {
> >         sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk);
> >         if (clk->status_reg) {
> > -               unsigned int (*read)(const void __iomem *addr);
> > +               unsigned int (*read)(void __iomem *addr);
> 
> While it is good to get rid of the wrappers, the change above will conflict with
> [PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic
> implementation)
> (https://lore.kernel.org/lkml/20200108200528.4614-2-krzk@kernel.org/),
> which will add const to ioread*().

Oh, I see.
Will consider about it, and post v2

Thank you for your help !!
Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  0:26 [PATCH][repost] SH: compile fixup patches Kuninori Morimoto
2020-01-09  0:28 ` [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions Kuninori Morimoto
2020-01-09  0:28 ` [PATCH][repost] sh: clkfwk: remove r8/r16/r32 Kuninori Morimoto
2020-01-09  8:18   ` Geert Uytterhoeven
2020-01-10  0:13     ` Kuninori Morimoto
2020-01-09  0:30 ` [PATCH][repost] SH: Convert iounmap() macros to inline functions Kuninori Morimoto

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org
	public-inbox-index linux-renesas-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git