linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: factor __used / __unused out of _OF_DECLARE()
@ 2016-06-06  9:45 Masahiro Yamada
  0 siblings, 0 replies; only message in thread
From: Masahiro Yamada @ 2016-06-06  9:45 UTC (permalink / raw)
  To: devicetree
  Cc: Arnd Bergmann, Rob Herring, Masahiro Yamada, Frank Rowand,
	Rob Herring, linux-kernel, Grant Likely

The difference between the "#if" and "#else" is __used / __unused,
so factor it out to avoid code duplication.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 include/linux/of.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index c7292e8..9b33e2e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -995,18 +995,17 @@ static inline int of_get_available_child_count(const struct device_node *np)
 }
 
 #if defined(CONFIG_OF) && !defined(MODULE)
-#define _OF_DECLARE(table, name, compat, fn, fn_type)			\
-	static const struct of_device_id __of_table_##name		\
-		__used __section(__##table##_of_table)			\
-		 = { .compatible = compat,				\
-		     .data = (fn == (fn_type)NULL) ? fn : fn  }
+#define OF_DECLARE_USED_OR_UNUSED	__used
 #else
+#define OF_DECLARE_USED_OR_UNUSED	__maybe_unused
+#endif
+
 #define _OF_DECLARE(table, name, compat, fn, fn_type)			\
 	static const struct of_device_id __of_table_##name		\
-		__attribute__((unused))					\
+		OF_DECLARE_USED_OR_UNUSED				\
+		__section(__##table##_of_table)				\
 		 = { .compatible = compat,				\
 		     .data = (fn == (fn_type)NULL) ? fn : fn }
-#endif
 
 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
 typedef void (*of_init_fn_1)(struct device_node *);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-06  9:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06  9:45 [PATCH] of: factor __used / __unused out of _OF_DECLARE() Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).