Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of: fix declaration of of_io_request_and_map

We are having build failure with linux-next for sparc allmodconfig with
the error messages:

drivers/built-in.o: In function `meson6_timer_init':
meson6_timer.c:(.init.text+0x5fe8): undefined reference to `of_io_request_and_map'
drivers/built-in.o: In function `mtk_timer_init':
mtk_timer.c:(.init.text+0x6af0): undefined reference to `of_io_request_and_map'
drivers/built-in.o: In function `asm9260_timer_init':
asm9260_timer.c:(.init.text+0x6c48): undefined reference to `of_io_request_and_map'

CONFIG_OF is defined for sparc so it is expected that we have a
definition of of_io_request_and_map() but of/address.c is only compiled
if it is !SPARC. In other words, CONFIG_OF_ADDRESS is not defined for
sparc so we get the build failure.

Fixes: e572f844ca66 ("clocksource/drivers/meson6: Add the COMPILE_TEST option")
Fixes: bec8c4617611 ("clocksource/drivers/mediatek: Add the COMPILE_TEST option")
Fixes: 4a373b45f94a ("clocksource/drivers/asm9260: Add the COMPILE_TEST option")
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
[robh: move include of io.h out of ifdef's]
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Sudip Mukherjee and committed by
Rob Herring
fcd71d9c 289582ea

+8 -11
+8 -11
include/linux/of_address.h
··· 3 3 #include <linux/ioport.h> 4 4 #include <linux/errno.h> 5 5 #include <linux/of.h> 6 + #include <linux/io.h> 6 7 7 8 struct of_pci_range_parser { 8 9 struct device_node *node; ··· 37 36 const struct of_device_id *matches, 38 37 u64 base_address); 39 38 extern void __iomem *of_iomap(struct device_node *device, int index); 39 + void __iomem *of_io_request_and_map(struct device_node *device, 40 + int index, const char *name); 40 41 41 42 /* Extract an address from a device, returns the region size and 42 43 * the address space flags too. The PCI version uses a BAR number ··· 60 57 u64 *paddr, u64 *size); 61 58 extern bool of_dma_is_coherent(struct device_node *np); 62 59 #else /* CONFIG_OF_ADDRESS */ 60 + static inline void __iomem *of_io_request_and_map(struct device_node *device, 61 + int index, const char *name) 62 + { 63 + return IOMEM_ERR_PTR(-EINVAL); 64 + } 63 65 64 66 static inline u64 of_translate_address(struct device_node *np, 65 67 const __be32 *addr) ··· 120 112 extern int of_address_to_resource(struct device_node *dev, int index, 121 113 struct resource *r); 122 114 void __iomem *of_iomap(struct device_node *node, int index); 123 - void __iomem *of_io_request_and_map(struct device_node *device, 124 - int index, const char *name); 125 115 #else 126 - 127 - #include <linux/io.h> 128 - 129 116 static inline int of_address_to_resource(struct device_node *dev, int index, 130 117 struct resource *r) 131 118 { ··· 130 127 static inline void __iomem *of_iomap(struct device_node *device, int index) 131 128 { 132 129 return NULL; 133 - } 134 - 135 - static inline void __iomem *of_io_request_and_map(struct device_node *device, 136 - int index, const char *name) 137 - { 138 - return IOMEM_ERR_PTR(-EINVAL); 139 130 } 140 131 #endif 141 132