Commit 4e84139e authored by Johannes Berg's avatar Johannes Berg Committed by Richard Weinberger

lib/logic_iomem: Fix 32-bit build

On a 32-bit build, the (unsigned long long) casts throw warnings
(or errors) due to being to a different integer size. Cast to
uintptr_t first (with the __force for sparse) and then further
to get the consistent print on 32 and 64-bit.

Fixes: ca2e3342 ("lib: add iomem emulation (logic_iomem)")
Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent d73820df
...@@ -79,7 +79,7 @@ static void __iomem *real_ioremap(phys_addr_t offset, size_t size) ...@@ -79,7 +79,7 @@ static void __iomem *real_ioremap(phys_addr_t offset, size_t size)
static void real_iounmap(void __iomem *addr) static void real_iounmap(void __iomem *addr)
{ {
WARN(1, "invalid iounmap for addr 0x%llx\n", WARN(1, "invalid iounmap for addr 0x%llx\n",
(unsigned long long __force)addr); (unsigned long long)(uintptr_t __force)addr);
} }
#endif /* CONFIG_LOGIC_IOMEM_FALLBACK */ #endif /* CONFIG_LOGIC_IOMEM_FALLBACK */
...@@ -173,7 +173,7 @@ EXPORT_SYMBOL(iounmap); ...@@ -173,7 +173,7 @@ EXPORT_SYMBOL(iounmap);
static u##sz real_raw_read ## op(const volatile void __iomem *addr) \ static u##sz real_raw_read ## op(const volatile void __iomem *addr) \
{ \ { \
WARN(1, "Invalid read" #op " at address %llx\n", \ WARN(1, "Invalid read" #op " at address %llx\n", \
(unsigned long long __force)addr); \ (unsigned long long)(uintptr_t __force)addr); \
return (u ## sz)~0ULL; \ return (u ## sz)~0ULL; \
} \ } \
\ \
...@@ -181,7 +181,8 @@ static void real_raw_write ## op(u ## sz val, \ ...@@ -181,7 +181,8 @@ static void real_raw_write ## op(u ## sz val, \
volatile void __iomem *addr) \ volatile void __iomem *addr) \
{ \ { \
WARN(1, "Invalid writeq" #op " of 0x%llx at address %llx\n", \ WARN(1, "Invalid writeq" #op " of 0x%llx at address %llx\n", \
(unsigned long long)val, (unsigned long long __force)addr);\ (unsigned long long)val, \
(unsigned long long)(uintptr_t __force)addr);\
} \ } \
MAKE_FALLBACK(b, 8); MAKE_FALLBACK(b, 8);
...@@ -194,14 +195,14 @@ MAKE_FALLBACK(q, 64); ...@@ -194,14 +195,14 @@ MAKE_FALLBACK(q, 64);
static void real_memset_io(volatile void __iomem *addr, int value, size_t size) static void real_memset_io(volatile void __iomem *addr, int value, size_t size)
{ {
WARN(1, "Invalid memset_io at address 0x%llx\n", WARN(1, "Invalid memset_io at address 0x%llx\n",
(unsigned long long __force)addr); (unsigned long long)(uintptr_t __force)addr);
} }
static void real_memcpy_fromio(void *buffer, const volatile void __iomem *addr, static void real_memcpy_fromio(void *buffer, const volatile void __iomem *addr,
size_t size) size_t size)
{ {
WARN(1, "Invalid memcpy_fromio at address 0x%llx\n", WARN(1, "Invalid memcpy_fromio at address 0x%llx\n",
(unsigned long long __force)addr); (unsigned long long)(uintptr_t __force)addr);
memset(buffer, 0xff, size); memset(buffer, 0xff, size);
} }
...@@ -210,7 +211,7 @@ static void real_memcpy_toio(volatile void __iomem *addr, const void *buffer, ...@@ -210,7 +211,7 @@ static void real_memcpy_toio(volatile void __iomem *addr, const void *buffer,
size_t size) size_t size)
{ {
WARN(1, "Invalid memcpy_toio at address 0x%llx\n", WARN(1, "Invalid memcpy_toio at address 0x%llx\n",
(unsigned long long __force)addr); (unsigned long long)(uintptr_t __force)addr);
} }
#endif /* CONFIG_LOGIC_IOMEM_FALLBACK */ #endif /* CONFIG_LOGIC_IOMEM_FALLBACK */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment