diff mbox series

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

Message ID 20200828021939.2912798-1-andrew@lunn.ch
State New
Headers show
Series of: of_match_node: Make stub an inline function to avoid W=1 warnings | expand

Commit Message

Andrew Lunn Aug. 28, 2020, 2:19 a.m. UTC
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@lunn.ch>
---
 include/linux/of.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

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 */