Skip to contentSkip to conversation

media: fsl-viu: Use proper check for presence of {out,in}_be32()

PATCH In review Fabio Estevam 2 participants 3 messages Nov 20, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: fsl-viu: Use proper check for presence of {out,in}_be32()

From: Geert Uytterhoeven <[email protected]>

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")
[fabio: adapt to mainline]
---
 arch/powerpc/include/asm/io.h    | 14 ++++++++++++++
 drivers/media/platform/fsl-viu.c |  5 +++--
 2 files changed, 17 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/io.h +14 -0
index 58635960403c..fcb250db110d 100644
@@ -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
  */
drivers/media/platform/fsl-viu.c +3 -2
index 4f2a0f992905..bb6c291ed6dc 100644
@@ -31,9 +31,10 @@
 #define DRV_NAME		"fsl_viu"
 #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
 
Signature · 1 line
2.17.1
#1 lore raw

Re: [PATCH] media: fsl-viu: Use proper check for presence of {out, in}_be32()

Quoted 34 lines · Fabio Estevam

From: Geert Uytterhoeven <[email protected]>

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")
[fabio: adapt to mainline]
---
 arch/powerpc/include/asm/io.h    | 14 ++++++++++++++
 drivers/media/platform/fsl-viu.c |  5 +++--
 2 files changed, 17 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/io.h +3 -0
index 58635960403c..fcb250db110d 100644
@@ -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

arch/powerpc/include/asm/io.h static inline void out_be64(volatile u64 __iomem *addr, u64 val) · line 209

Quoted 10 lines
arch/powerpc/include/asm/io.h +10 -0
+#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

I'd rather not have to carry this in arch code just for one driver.

Quoted 6 lines
drivers/media/platform/fsl-viu.c +0 -0
index 4f2a0f992905..bb6c291ed6dc 100644
@@ -31,9 +31,10 @@
 #define DRV_NAME		"fsl_viu"

drivers/media/platform/fsl-viu.c line 39

Quoted 10 lines
drivers/media/platform/fsl-viu.c +3 -2
 #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

Can't the driver just use ioread/write32be() on all platforms?

cheers

#2 lore raw

Re: [PATCH] media: fsl-viu: Use proper check for presence of {out, in}_be32()

Hi Michael,

Quoted 1 line · Michael Ellerman

I'd rather not have to carry this in arch code just for one driver.

Fair enough.

Quoted 1 line

Can't the driver just use ioread/write32be() on all platforms?

Yes, this is a better approach. I have just a patch doing that.

Thanks