linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: fsl-viu: Use proper check for presence of {out,in}_be32()
@ 2018-06-08  9:48 Geert Uytterhoeven
  2018-06-15  8:10 ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2018-06-08  9:48 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Mauro Carvalho Chehab
  Cc: Arnd Bergmann, linuxppc-dev, linux-media, linux-kernel,
	Geert Uytterhoeven

When compile-testing on m68k or microblaze:

    drivers/media/platform/fsl-viu.c:41:1: warning: "out_be32" redefined
    drivers/media/platform/fsl-viu.c:42:1: warning: "in_be32" redefined

Fix this by replacing the check for PowerPC by checks for the presence
of {out,in}_be32().

As PowerPC implements the be32 accessors using inline functions instead
of macros, identity definions are added for all accessors to make the
above checks work.

Fixes: 29d750686331a1a9 ("media: fsl-viu: allow building it with COMPILE_TEST")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Compile-tested on m68k, microblaze, and powerpc.
Assembler output before/after compared for powerpc.
---
 arch/powerpc/include/asm/io.h    | 14 ++++++++++++++
 drivers/media/platform/fsl-viu.c |  4 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index e0331e7545685c5f..3741183ae09349f1 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -222,6 +222,20 @@ static inline void out_be64(volatile u64 __iomem *addr, u64 val)
 #endif
 #endif /* __powerpc64__ */
 
+#define in_be16 in_be16
+#define in_be32 in_be32
+#define in_be64 in_be64
+#define in_le16 in_le16
+#define in_le32 in_le32
+#define in_le64 in_le64
+
+#define out_be16 out_be16
+#define out_be32 out_be32
+#define out_be64 out_be64
+#define out_le16 out_le16
+#define out_le32 out_le32
+#define out_le64 out_le64
+
 /*
  * Low level IO stream instructions are defined out of line for now
  */
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index e41510ce69a40815..5d5e030c9c980647 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -37,8 +37,10 @@
 #define VIU_VERSION		"0.5.1"
 
 /* Allow building this driver with COMPILE_TEST */
-#ifndef CONFIG_PPC
+#ifndef out_be32
 #define out_be32(v, a)	iowrite32be(a, (void __iomem *)v)
+#endif
+#ifndef in_be32
 #define in_be32(a)	ioread32be((void __iomem *)a)
 #endif
 
-- 
2.7.4

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

* Re: [PATCH] media: fsl-viu: Use proper check for presence of {out,in}_be32()
  2018-06-08  9:48 [PATCH] media: fsl-viu: Use proper check for presence of {out,in}_be32() Geert Uytterhoeven
@ 2018-06-15  8:10 ` Hans Verkuil
  2019-01-18 10:07   ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2018-06-15  8:10 UTC (permalink / raw)
  To: Geert Uytterhoeven, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Mauro Carvalho Chehab
  Cc: Arnd Bergmann, linuxppc-dev, linux-media, linux-kernel

On 08/06/18 11:48, Geert Uytterhoeven wrote:
> When compile-testing on m68k or microblaze:
> 
>     drivers/media/platform/fsl-viu.c:41:1: warning: "out_be32" redefined
>     drivers/media/platform/fsl-viu.c:42:1: warning: "in_be32" redefined
> 
> Fix this by replacing the check for PowerPC by checks for the presence
> of {out,in}_be32().
> 
> As PowerPC implements the be32 accessors using inline functions instead
> of macros, identity definions are added for all accessors to make the
> above checks work.
> 
> Fixes: 29d750686331a1a9 ("media: fsl-viu: allow building it with COMPILE_TEST")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>

Should this go through the media tree or powerpc tree? Either way works for me.

Regards,

	Hans

> ---
> Compile-tested on m68k, microblaze, and powerpc.
> Assembler output before/after compared for powerpc.
> ---
>  arch/powerpc/include/asm/io.h    | 14 ++++++++++++++
>  drivers/media/platform/fsl-viu.c |  4 +++-
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> index e0331e7545685c5f..3741183ae09349f1 100644
> --- a/arch/powerpc/include/asm/io.h
> +++ b/arch/powerpc/include/asm/io.h
> @@ -222,6 +222,20 @@ static inline void out_be64(volatile u64 __iomem *addr, u64 val)
>  #endif
>  #endif /* __powerpc64__ */
>  
> +#define in_be16 in_be16
> +#define in_be32 in_be32
> +#define in_be64 in_be64
> +#define in_le16 in_le16
> +#define in_le32 in_le32
> +#define in_le64 in_le64
> +
> +#define out_be16 out_be16
> +#define out_be32 out_be32
> +#define out_be64 out_be64
> +#define out_le16 out_le16
> +#define out_le32 out_le32
> +#define out_le64 out_le64
> +
>  /*
>   * Low level IO stream instructions are defined out of line for now
>   */
> diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
> index e41510ce69a40815..5d5e030c9c980647 100644
> --- a/drivers/media/platform/fsl-viu.c
> +++ b/drivers/media/platform/fsl-viu.c
> @@ -37,8 +37,10 @@
>  #define VIU_VERSION		"0.5.1"
>  
>  /* Allow building this driver with COMPILE_TEST */
> -#ifndef CONFIG_PPC
> +#ifndef out_be32
>  #define out_be32(v, a)	iowrite32be(a, (void __iomem *)v)
> +#endif
> +#ifndef in_be32
>  #define in_be32(a)	ioread32be((void __iomem *)a)
>  #endif
>  
> 


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

* Re: [PATCH] media: fsl-viu: Use proper check for presence of {out,in}_be32()
  2018-06-15  8:10 ` Hans Verkuil
@ 2019-01-18 10:07   ` Hans Verkuil
  2019-01-18 10:45     ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2019-01-18 10:07 UTC (permalink / raw)
  To: Geert Uytterhoeven, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Mauro Carvalho Chehab
  Cc: Arnd Bergmann, linuxppc-dev, linux-media, linux-kernel

Hi Geert,

This patch is still in my patchwork todo list, and I wonder who will pick this up,
especially the change to arch/powerpc/include/asm/io.h.

Wouldn't it be easier to just fix this in fsl-viu.c only by doing this:

#ifndef CONFIG_PPC
#ifndef out_be32
#define out_be32(v, a)  iowrite32be(a, (void __iomem *)v)
#endif
#ifndef in_be32
#define in_be32(a)      ioread32be((void __iomem *)a)
#endif
#endif

Basically just your patch, but without removing #ifndef CONFIG_PPC.

That way there is no need to touch arch/powerpc/include/asm/io.h.

Regards,

	Hans

On 6/15/18 10:10 AM, Hans Verkuil wrote:
> On 08/06/18 11:48, Geert Uytterhoeven wrote:
>> When compile-testing on m68k or microblaze:
>>
>>     drivers/media/platform/fsl-viu.c:41:1: warning: "out_be32" redefined
>>     drivers/media/platform/fsl-viu.c:42:1: warning: "in_be32" redefined
>>
>> Fix this by replacing the check for PowerPC by checks for the presence
>> of {out,in}_be32().
>>
>> As PowerPC implements the be32 accessors using inline functions instead
>> of macros, identity definions are added for all accessors to make the
>> above checks work.
>>
>> Fixes: 29d750686331a1a9 ("media: fsl-viu: allow building it with COMPILE_TEST")
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
> 
> Should this go through the media tree or powerpc tree? Either way works for me.
> 
> Regards,
> 
> 	Hans
> 
>> ---
>> Compile-tested on m68k, microblaze, and powerpc.
>> Assembler output before/after compared for powerpc.
>> ---
>>  arch/powerpc/include/asm/io.h    | 14 ++++++++++++++
>>  drivers/media/platform/fsl-viu.c |  4 +++-
>>  2 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
>> index e0331e7545685c5f..3741183ae09349f1 100644
>> --- a/arch/powerpc/include/asm/io.h
>> +++ b/arch/powerpc/include/asm/io.h
>> @@ -222,6 +222,20 @@ static inline void out_be64(volatile u64 __iomem *addr, u64 val)
>>  #endif
>>  #endif /* __powerpc64__ */
>>  
>> +#define in_be16 in_be16
>> +#define in_be32 in_be32
>> +#define in_be64 in_be64
>> +#define in_le16 in_le16
>> +#define in_le32 in_le32
>> +#define in_le64 in_le64
>> +
>> +#define out_be16 out_be16
>> +#define out_be32 out_be32
>> +#define out_be64 out_be64
>> +#define out_le16 out_le16
>> +#define out_le32 out_le32
>> +#define out_le64 out_le64
>> +
>>  /*
>>   * Low level IO stream instructions are defined out of line for now
>>   */
>> diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
>> index e41510ce69a40815..5d5e030c9c980647 100644
>> --- a/drivers/media/platform/fsl-viu.c
>> +++ b/drivers/media/platform/fsl-viu.c
>> @@ -37,8 +37,10 @@
>>  #define VIU_VERSION		"0.5.1"
>>  
>>  /* Allow building this driver with COMPILE_TEST */
>> -#ifndef CONFIG_PPC
>> +#ifndef out_be32
>>  #define out_be32(v, a)	iowrite32be(a, (void __iomem *)v)
>> +#endif
>> +#ifndef in_be32
>>  #define in_be32(a)	ioread32be((void __iomem *)a)
>>  #endif
>>  
>>
> 
> 


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

* Re: [PATCH] media: fsl-viu: Use proper check for presence of {out,in}_be32()
  2019-01-18 10:07   ` Hans Verkuil
@ 2019-01-18 10:45     ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-01-18 10:45 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Mauro Carvalho Chehab, Arnd Bergmann, linuxppc-dev,
	Linux Media Mailing List, Linux Kernel Mailing List

Hi Hans,

On Fri, Jan 18, 2019 at 11:08 AM Hans Verkuil <hverkuil@xs4all.nl> wrote:
> This patch is still in my patchwork todo list, and I wonder who will pick this up,
> especially the change to arch/powerpc/include/asm/io.h.

I think the powerpc tree makes most sense.

> Wouldn't it be easier to just fix this in fsl-viu.c only by doing this:
>
> #ifndef CONFIG_PPC
> #ifndef out_be32
> #define out_be32(v, a)  iowrite32be(a, (void __iomem *)v)
> #endif
> #ifndef in_be32
> #define in_be32(a)      ioread32be((void __iomem *)a)
> #endif
> #endif
>
> Basically just your patch, but without removing #ifndef CONFIG_PPC.
>
> That way there is no need to touch arch/powerpc/include/asm/io.h.

While I agree that avoids touching the powerpc tree, it doesn't solve
the problem
in the long run.
All drivers using e.g. out_be32() would need an extra check for CONFIG_PPC
to enable compile-testing.  The same is true when handling this in asm-generic.

> On 6/15/18 10:10 AM, Hans Verkuil wrote:
> > On 08/06/18 11:48, Geert Uytterhoeven wrote:
> >> When compile-testing on m68k or microblaze:
> >>
> >>     drivers/media/platform/fsl-viu.c:41:1: warning: "out_be32" redefined
> >>     drivers/media/platform/fsl-viu.c:42:1: warning: "in_be32" redefined
> >>
> >> Fix this by replacing the check for PowerPC by checks for the presence
> >> of {out,in}_be32().
> >>
> >> As PowerPC implements the be32 accessors using inline functions instead
> >> of macros, identity definions are added for all accessors to make the
> >> above checks work.
> >>
> >> Fixes: 29d750686331a1a9 ("media: fsl-viu: allow building it with COMPILE_TEST")
> >> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> >
> > Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
> >
> > Should this go through the media tree or powerpc tree? Either way works for me.
> >
> > Regards,
> >
> >       Hans
> >
> >> ---
> >> Compile-tested on m68k, microblaze, and powerpc.
> >> Assembler output before/after compared for powerpc.
> >> ---
> >>  arch/powerpc/include/asm/io.h    | 14 ++++++++++++++
> >>  drivers/media/platform/fsl-viu.c |  4 +++-
> >>  2 files changed, 17 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> >> index e0331e7545685c5f..3741183ae09349f1 100644
> >> --- a/arch/powerpc/include/asm/io.h
> >> +++ b/arch/powerpc/include/asm/io.h
> >> @@ -222,6 +222,20 @@ static inline void out_be64(volatile u64 __iomem *addr, u64 val)
> >>  #endif
> >>  #endif /* __powerpc64__ */
> >>
> >> +#define in_be16 in_be16
> >> +#define in_be32 in_be32
> >> +#define in_be64 in_be64
> >> +#define in_le16 in_le16
> >> +#define in_le32 in_le32
> >> +#define in_le64 in_le64
> >> +
> >> +#define out_be16 out_be16
> >> +#define out_be32 out_be32
> >> +#define out_be64 out_be64
> >> +#define out_le16 out_le16
> >> +#define out_le32 out_le32
> >> +#define out_le64 out_le64
> >> +
> >>  /*
> >>   * Low level IO stream instructions are defined out of line for now
> >>   */
> >> diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
> >> index e41510ce69a40815..5d5e030c9c980647 100644
> >> --- a/drivers/media/platform/fsl-viu.c
> >> +++ b/drivers/media/platform/fsl-viu.c
> >> @@ -37,8 +37,10 @@
> >>  #define VIU_VERSION         "0.5.1"
> >>
> >>  /* Allow building this driver with COMPILE_TEST */
> >> -#ifndef CONFIG_PPC
> >> +#ifndef out_be32
> >>  #define out_be32(v, a)      iowrite32be(a, (void __iomem *)v)
> >> +#endif
> >> +#ifndef in_be32
> >>  #define in_be32(a)  ioread32be((void __iomem *)a)
> >>  #endif

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] 5+ messages in thread

* [PATCH] media: fsl-viu: Use proper check for presence of {out,in}_be32()
@ 2020-11-19  8:01 Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2020-11-19  8:01 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Mauro Carvalho Chehab, Fabio Estevam
  Cc: Hans Verkuil, Arnd Bergmann, linuxppc-dev, linux-media,
	linux-kernel, Geert Uytterhoeven, kernel test robot

When compile-testing on m68k/randconfig:

    drivers/media/platform/fsl-viu.c: In function 'viu_start_dma':
    drivers/media/platform/fsl-viu.c:253:2: error: implicit declaration of function 'out_be32' [-Werror=implicit-function-declaration]
    drivers/media/platform/fsl-viu.c: In function 'viu_stop_dma':
    drivers/media/platform/fsl-viu.c:266:15: error: implicit declaration of function 'in_be32' [-Werror=implicit-function-declaration]

Fix this by replacing the checks for PowerPC, Microblaze, and m68k by
checks for the presence of {out,in}_be32().

As PowerPC implements the be32 accessors using inline functions instead
of macros, identity definitions are added for all accessors to make the
above checks work.

Fixes: 29d750686331a1a9 ("media: fsl-viu: allow building it with COMPILE_TEST")
Fixes: 17621758e53f0e6b ("media: fsl-viu: Do not redefine out_be32()/in_be32() for CONFIG_M68K")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
---
Compile-tested on m68k, microblaze, and powerpc.
Assembler output before/after compared for powerpc.

v2:
  - Add Reviewed-by,
  - s/definions/definitions/,
  - Update for commits 6898dd580a045341 ("media: media/platform:
    fsl-viu.c: fix build for MICROBLAZE") and 17621758e53f0e6b ("media:
    fsl-viu: Do not redefine out_be32()/in_be32() for CONFIG_M68K"),
    which added checks for Microblaze and m68k (the latter is not
    sufficient, cfr. the report from the kernel test robot).

v1: https://lore.kernel.org/lkml/1528451328-21316-1-git-send-email-geert@linux-m68k.org/
---
 arch/powerpc/include/asm/io.h    | 14 ++++++++++++++
 drivers/media/platform/fsl-viu.c |  4 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 58635960403c058b..fcb250db110d8e2b 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -194,6 +194,20 @@ static inline void out_be64(volatile u64 __iomem *addr, u64 val)
 #endif
 #endif /* __powerpc64__ */
 
+#define in_be16 in_be16
+#define in_be32 in_be32
+#define in_be64 in_be64
+#define in_le16 in_le16
+#define in_le32 in_le32
+#define in_le64 in_le64
+
+#define out_be16 out_be16
+#define out_be32 out_be32
+#define out_be64 out_be64
+#define out_le16 out_le16
+#define out_le32 out_le32
+#define out_le64 out_le64
+
 /*
  * Low level IO stream instructions are defined out of line for now
  */
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 4f2a0f992905b4b3..d8a6dd4ffbad56d6 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -32,8 +32,10 @@
 #define VIU_VERSION		"0.5.1"
 
 /* Allow building this driver with COMPILE_TEST */
-#if !defined(CONFIG_PPC) && !defined(CONFIG_MICROBLAZE) && !defined(CONFIG_M68K)
+#ifndef out_be32
 #define out_be32(v, a)	iowrite32be(a, (void __iomem *)v)
+#endif
+#ifndef in_be32
 #define in_be32(a)	ioread32be((void __iomem *)a)
 #endif
 
-- 
2.25.1


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

end of thread, other threads:[~2020-11-19  8:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08  9:48 [PATCH] media: fsl-viu: Use proper check for presence of {out,in}_be32() Geert Uytterhoeven
2018-06-15  8:10 ` Hans Verkuil
2019-01-18 10:07   ` Hans Verkuil
2019-01-18 10:45     ` Geert Uytterhoeven
2020-11-19  8:01 Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).