* [PATCH] of: Provide static inline function for of_translate_address if needed
@ 2015-11-07 3:28 Guenter Roeck
2015-11-07 9:02 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2015-11-07 3:28 UTC (permalink / raw)
To: Rob Herring
Cc: Frank Rowand, devicetree, linux-kernel, Guenter Roeck, Arnd Bergmann
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>
---
include/linux/of.h | 4 ++--
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;
#define OF_POPULATED 3 /* device already created for the node */
#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */
+#define OF_BAD_ADDR ((u64)-1)
+
#ifdef CONFIG_OF
void of_core_init(void);
@@ -229,8 +231,6 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
-#define OF_BAD_ADDR ((u64)-1)
-
static inline const char *of_node_full_name(const struct device_node *np)
{
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,
u64 *paddr, u64 *size);
extern bool of_dma_is_coherent(struct device_node *np);
#else /* CONFIG_OF_ADDRESS */
+
+static inline u64 of_translate_address(struct device_node *np,
+ const __be32 *addr)
+{
+ return OF_BAD_ADDR;
+}
+
static inline struct device_node *of_find_matching_node_by_address(
struct device_node *from,
const struct of_device_id *matches,
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] of: Provide static inline function for of_translate_address if needed
@ 2015-11-07 9:02 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2015-11-07 9:02 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Rob Herring, Frank Rowand, devicetree, linux-kernel
On Friday 06 November 2015 19:28:22 Guenter Roeck wrote:
> 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>
Thanks for the fix.
Rob/Frank, any chance we get this into -rc1 through your tree?
The background is that a bugfix I did for a network driver started
causing the build error on sparc allmodconfig, and it would be nice
to have 4.4-rc1 build fine without having to back out my fix.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] of: Provide static inline function for of_translate_address if needed
@ 2015-11-07 9:02 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2015-11-07 9:02 UTC (permalink / raw)
To: Guenter Roeck
Cc: Rob Herring, Frank Rowand, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Friday 06 November 2015 19:28:22 Guenter Roeck wrote:
> 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-r2nGTMty4D4@public.gmane.org>
> Signed-off-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Reviewed-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Thanks for the fix.
Rob/Frank, any chance we get this into -rc1 through your tree?
The background is that a bugfix I did for a network driver started
causing the build error on sparc allmodconfig, and it would be nice
to have 4.4-rc1 build fine without having to back out my fix.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-07 9:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07 3:28 [PATCH] of: Provide static inline function for of_translate_address if needed Guenter Roeck
2015-11-07 9:02 ` Arnd Bergmann
2015-11-07 9:02 ` Arnd Bergmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.