The common wc-ioremap carveout callbacks live in
remoteproc_internal.h, which is included by the remoteproc core.
This means the helper bodies are parsed even for builds that do not
enable any platform driver using those callbacks.

On s390, CONFIG_HAS_IOMEM and CONFIG_GENERIC_IOREMAP depend on
CONFIG_PCI. A randconfig with CONFIG_REMOTEPROC=y and CONFIG_PCI=n
therefore has no usable ioremap_wc() or iounmap() declarations, and
fails to build the common remoteproc objects with implicit declarations
from the helper bodies.

Only include linux/io.h and build the real wc-ioremap helpers when
CONFIG_HAS_IOMEM is enabled. Provide no-IOMEM stubs so the internal
header remains self-contained for randconfig and COMPILE_TEST coverage.

Fixes: 50227acbf4e5 ("remoteproc: Add common wc-ioremap carveout callbacks")
Reported-by: kernel test robot <[email protected]>
Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Ben Levinsky <[email protected]>

diff --git a/drivers/remoteproc/remoteproc_internal.h 
b/drivers/remoteproc/remoteproc_internal.h
index 02c00475b010..3a742ef6ef60 100644
--- a/drivers/remoteproc/remoteproc_internal.h
+++ b/drivers/remoteproc/remoteproc_internal.h
@@ -14,7 +14,9 @@
 
 #include <linux/irqreturn.h>
 #include <linux/firmware.h>
+#ifdef CONFIG_HAS_IOMEM
 #include <linux/io.h>
+#endif
 
 struct rproc;
 
@@ -123,6 +125,7 @@ rproc_find_carveout_by_name(struct rproc *rproc, const char 
*name, ...);
 void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev);
 void rproc_remove_rvdev(struct rproc_vdev *rvdev);
 
+#ifdef CONFIG_HAS_IOMEM
 static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
                                             struct rproc_mem_entry *mem)
 {
@@ -148,6 +151,19 @@ static inline int rproc_mem_entry_iounmap(struct rproc 
*rproc,
 
        return 0;
 }
+#else
+static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
+                                            struct rproc_mem_entry *mem)
+{
+       return -EOPNOTSUPP;
+}
+
+static inline int rproc_mem_entry_iounmap(struct rproc *rproc,
+                                         struct rproc_mem_entry *mem)
+{
+       return 0;
+}
+#endif
 
 #define rproc_elf_load_rsc_table_optional(rproc, fw, dev_func, fmt, ...)       
\
        ({                                                                      
\
-- 
2.34.1


Reply via email to