[PATCH] iomap: Fix -Wmissing-prototypes on UM
From: Thomas Weißschuh
Date: Mon Feb 03 2025 - 02:26:46 EST
Building lib/iomap.o on UM triggers warnings about missing prototypes.
These prototypes should be defined by asm-generic/iomap.h, depending on
other symbols. For example "ioread64_lo_hi" is based on "readq".
However the generic variants of those tested symbols are defined in
asm-generic/io.h, only after asm-generic/iomap.h has already been
included, breaking the ifdef logic.
Move the inclusion of asm-generic/iomap.h in asm-generic/io.h after the
generic symbols have been defined, so the checks can work.
Triggered warnings:
$ make ARCH=um allyesconfig lib/iomap.o
make[1]: Entering directory '/tmp/um'
GEN Makefile
GEN Makefile
CALL scripts/checksyscalls.sh
CC lib/iomap.o
lib/iomap.c:156:5: error: no previous prototype for ‘ioread64_lo_hi’ [-Werror=missing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~
lib/iomap.c:163:5: error: no previous prototype for ‘ioread64_hi_lo’ [-Werror=missing-prototypes]
163 | u64 ioread64_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~
lib/iomap.c:170:5: error: no previous prototype for ‘ioread64be_lo_hi’ [-Werror=missing-prototypes]
170 | u64 ioread64be_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
lib/iomap.c:178:5: error: no previous prototype for ‘ioread64be_hi_lo’ [-Werror=missing-prototypes]
178 | u64 ioread64be_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
lib/iomap.c:264:6: error: no previous prototype for ‘iowrite64_lo_hi’ [-Werror=missing-prototypes]
264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
lib/iomap.c:272:6: error: no previous prototype for ‘iowrite64_hi_lo’ [-Werror=missing-prototypes]
272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
lib/iomap.c:280:6: error: no previous prototype for ‘iowrite64be_lo_hi’ [-Werror=missing-prototypes]
280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
iomap.c:288:6: error: no previous prototype for ‘iowrite64be_hi_lo’ [-Werror=missing-prototypes]
288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Fixes: 0fcb70851fbf ("Makefile.extrawarn: turn on missing-prototypes globally")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
include/asm-generic/io.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index a5cbbf3e26ec7d06f7e67ee9731021031b39aa13..1bfdc4d5643054701c27073c146a6d8cc3903384 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -13,10 +13,6 @@
#include <linux/types.h>
#include <linux/instruction_pointer.h>
-#ifdef CONFIG_GENERIC_IOMAP
-#include <asm-generic/iomap.h>
-#endif
-
#include <asm/mmiowb.h>
#include <asm-generic/pci_iomap.h>
@@ -1250,4 +1246,8 @@ extern int devmem_is_allowed(unsigned long pfn);
#endif /* __KERNEL__ */
+#ifdef CONFIG_GENERIC_IOMAP
+#include <asm-generic/iomap.h>
+#endif
+
#endif /* __ASM_GENERIC_IO_H */
---
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
change-id: 20250129-um-io-6ffdf196774c
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>