[PATCH] of: of_match_node: Make stub an inline function to avoid W=1 warnings

From: Andrew Lunn
Date: Thu Aug 27 2020 - 22:20:09 EST


When building without CONFIG_OF and W=1, errors are given about unused
arrays of match data, because of_match_node is stubbed as a macro. The
compile does not see it takes parameters when not astub, so it
generates warnings about unused variables. Replace the stub with an
inline function to avoid these false warnings.

Signed-off-by: Andrew Lunn <andrew@xxxxxxx>
---
include/linux/of.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index 5cf7ae0465d1..e9838387e7d9 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -991,7 +991,12 @@ static inline int of_map_id(struct device_node *np, u32 id,
}

#define of_match_ptr(_ptr) NULL
-#define of_match_node(_matches, _node) NULL
+
+static inline const struct of_device_id *of_match_node(
+ const struct of_device_id *matches, const struct device_node *node)
+{
+ return NULL;
+}
#endif /* CONFIG_OF */

/* Default string compare functions, Allow arch asm/prom.h to override */
--
2.28.0