[U-Boot] [PATCH 3/6] arm: Allow u32 as addrs for readX/writeX
Alexander Graf
agraf at suse.de
Tue Mar 29 17:29:08 CEST 2016
Gcc warns when you try to cast a u32 value into a pointer directly. When someone
calls functions like readl or writel, he's pretty sure the parameter he passes
is an address though, so we can as well cast it for him.
This makes porting 32bit code to armv8 easier, as it means we don't have to
touch common board code with explicit casts or UL redefines.
Signed-off-by: Alexander Graf <agraf at suse.de>
---
arch/arm/include/asm/io.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 75773bd..b85f4d7 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -67,15 +67,15 @@ static inline phys_addr_t virt_to_phys(void * vaddr)
* read/writes. We define __arch_*[bl] here, and leave __arch_*w
* to the architecture specific code.
*/
-#define __arch_getb(a) (*(volatile unsigned char *)(a))
-#define __arch_getw(a) (*(volatile unsigned short *)(a))
-#define __arch_getl(a) (*(volatile unsigned int *)(a))
-#define __arch_getq(a) (*(volatile unsigned long long *)(a))
-
-#define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v))
-#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
-#define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
-#define __arch_putq(v,a) (*(volatile unsigned long long *)(a) = (v))
+#define __arch_getb(a) (*(volatile unsigned char *)(long)(a))
+#define __arch_getw(a) (*(volatile unsigned short *)(long)(a))
+#define __arch_getl(a) (*(volatile unsigned int *)(long)(a))
+#define __arch_getq(a) (*(volatile unsigned long long *)(long)(a))
+
+#define __arch_putb(v,a) (*(volatile unsigned char *)(long)(a) = (v))
+#define __arch_putw(v,a) (*(volatile unsigned short *)(long)(a) = (v))
+#define __arch_putl(v,a) (*(volatile unsigned int *)(long)(a) = (v))
+#define __arch_putq(v,a) (*(volatile unsigned long long *)(long)(a) = (v))
static inline void __raw_writesb(unsigned long addr, const void *data,
int bytelen)
--
1.8.5.6
More information about the U-Boot
mailing list