diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-11-06 22:28:22 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2015-11-10 18:27:12 -0500 |
commit | b1d06b60e90cd5016798b9984f8e420e753f4846 (patch) | |
tree | 5ff1f8763ebddbcb9bb7a3a5cbc8a7b7029ab9ad | |
parent | 1cc8e3458b5110253c8f5aaf1890d5ffea9bb7b7 (diff) |
of: Provide static inline function for of_translate_address if needed
If OF_ADDRESS is not configured, builds can fail with errors such as
drivers/net/ethernet/hisilicon/hns_mdio.c:
In function 'hns_mdio_bus_name':
drivers/net/ethernet/hisilicon/hns_mdio.c:411:3:
error: implicit declaration of function 'of_translate_address'
as currently seen when building sparc:allmodconfig.
Introduce a static inline function if OF_ADDRESS is not configured to fix
the build failure. Return OF_BAD_ADDR in this case. For this to work, the
definition of OF_BAD_ADDR has to be moved outside CONFIG_OF conditional
code.
Fixes: 876133d3161d ("net: hisilicon: add OF dependency")
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r-- | include/linux/of.h | 4 | ||||
-rw-r--r-- | include/linux/of_address.h | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 2194b8ca41f9..dd10626a615f 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -126,6 +126,8 @@ extern raw_spinlock_t devtree_lock; | |||
126 | #define OF_POPULATED 3 /* device already created for the node */ | 126 | #define OF_POPULATED 3 /* device already created for the node */ |
127 | #define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */ | 127 | #define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */ |
128 | 128 | ||
129 | #define OF_BAD_ADDR ((u64)-1) | ||
130 | |||
129 | #ifdef CONFIG_OF | 131 | #ifdef CONFIG_OF |
130 | void of_core_init(void); | 132 | void of_core_init(void); |
131 | 133 | ||
@@ -229,8 +231,6 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size) | |||
229 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | 231 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) |
230 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | 232 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) |
231 | 233 | ||
232 | #define OF_BAD_ADDR ((u64)-1) | ||
233 | |||
234 | static inline const char *of_node_full_name(const struct device_node *np) | 234 | static inline const char *of_node_full_name(const struct device_node *np) |
235 | { | 235 | { |
236 | return np ? np->full_name : "<no-node>"; | 236 | return np ? np->full_name : "<no-node>"; |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index d88e81be6368..507daad0bc8d 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h | |||
@@ -57,6 +57,13 @@ extern int of_dma_get_range(struct device_node *np, u64 *dma_addr, | |||
57 | u64 *paddr, u64 *size); | 57 | u64 *paddr, u64 *size); |
58 | extern bool of_dma_is_coherent(struct device_node *np); | 58 | extern bool of_dma_is_coherent(struct device_node *np); |
59 | #else /* CONFIG_OF_ADDRESS */ | 59 | #else /* CONFIG_OF_ADDRESS */ |
60 | |||
61 | static inline u64 of_translate_address(struct device_node *np, | ||
62 | const __be32 *addr) | ||
63 | { | ||
64 | return OF_BAD_ADDR; | ||
65 | } | ||
66 | |||
60 | static inline struct device_node *of_find_matching_node_by_address( | 67 | static inline struct device_node *of_find_matching_node_by_address( |
61 | struct device_node *from, | 68 | struct device_node *from, |
62 | const struct of_device_id *matches, | 69 | const struct of_device_id *matches, |