@@ -202,16 +202,7 @@ struct odp_module_base {
static void __attribute__((constructor(102))) \
odp_ ## name ## _module_constructor(void)
-/* All subsystems' initialization and termination routines are
- * the same, provide template to help generate similar routines
- * automatically, examples:
- *
- * ODP_SUBSYSTEM_FOREACH_TEMPLATE(subsystem, init_global, DBG)
- * will generate a function walk through all the modules of the
- * subsystem and invoke init_global method for each.
- */
-#define ODP_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \
-int odp_ ## subs ##_## method(bool continue_on_errors) \
+#define _SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \
{ \
int result = 0; \
ODP_MODULE_CLASS(subs) * mod = NULL; \
@@ -237,6 +228,32 @@ done: \
return result; \
}
+/* ODP_SUBSYSTEM_FOREACH_TEMPLATE() generates subsystems
+ * initialization and termination routines automatically,
+ * examples:
+ *
+ * ODP_SUBSYSTEM_FOREACH_TEMPLATE(subsystem, init_global, DBG)
+ * will generate a function walk through all the modules of the
+ * subsystem and invoke init_global method for each.
+ */
+
+#define ODP_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \
+int odp_ ## subs ##_## method(bool continue_on_errors) \
+_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print)
+
+/* SUBSYSTEM_FOREACH_TEMPLATE() generates static walk through
+ * functions to invoke subsystem's modules initialization or
+ * termination methods, examples:
+ *
+ * SUBSYSTEM_FOREACH_TEMPLATE(subsystem, init_global, DBG)
+ * will generate a function walk through all the modules of the
+ * subsystem and invoke init_global method for each.
+ */
+
+#define SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print) \
+static int subs ##_## method(bool continue_on_errors) \
+_SUBSYSTEM_FOREACH_TEMPLATE(subs, method, print)
+
/* Subsystem Modules Registration
*
* odp_subsystem_register_module() are called by all modules in their