[PATCH] of: factor __used / __unused out of _OF_DECLARE()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxx>
---

 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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux