diff mbox

[v2,4/4] api: move loging out of odp_debug

Message ID 1421797078-14262-4-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 1b4f5edbe65fd82f9dba28697f4724bcff27b4ca
Headers show

Commit Message

Mike Holmes Jan. 20, 2015, 11:37 p.m. UTC
Only odp_init needs the logging definitions so remove them from
odp_debug.h

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/api/odp_debug.h | 32 --------------------
 platform/linux-generic/include/api/odp_init.h  | 41 +++++++++++++++++++++++++-
 platform/linux-generic/include/odp_internal.h  |  2 +-
 3 files changed, 41 insertions(+), 34 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h
index 4c32500..ce07e85 100644
--- a/platform/linux-generic/include/api/odp_debug.h
+++ b/platform/linux-generic/include/api/odp_debug.h
@@ -48,38 +48,6 @@  extern "C" {
 #define _ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
 
 /**
- * ODP log level.
- */
-typedef enum odp_log_level {
-	ODP_LOG_DBG,
-	ODP_LOG_ERR,
-	ODP_LOG_UNIMPLEMENTED,
-	ODP_LOG_ABORT,
-	ODP_LOG_PRINT
-} odp_log_level_e;
-
-/**
- * ODP log function
- *
- * Instead of direct prints to stdout/stderr all logging in ODP implementation
- * should be done via this function or its wrappers.
- * ODP platform MUST provide a default *weak* implementation of this function.
- * Application MAY override the function if needed by providing a strong
- * function.
- *
- * @param[in] level   Log level
- * @param[in] fmt     printf-style message format
- *
- * @return The number of characters logged if succeeded. Otherwise returns
- *         a negative number.
- */
-extern int odp_override_log(odp_log_level_e level, const char *fmt, ...);
-
-
-/** Replaceable logging function */
-typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...);
-
-/**
  * @}
  */
 
diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
index 73c4a3b..ac856df 100644
--- a/platform/linux-generic/include/api/odp_init.h
+++ b/platform/linux-generic/include/api/odp_init.h
@@ -29,13 +29,52 @@  extern "C" {
 
 
 #include <odp_std_types.h>
-#include <odp_debug.h>
 
 /** @defgroup odp_initialization ODP INITIALIZATION
  *  Initialisation operations.
  *  @{
  */
 
+/**
+ * ODP log level.
+ */
+typedef enum odp_log_level {
+	ODP_LOG_DBG,
+	ODP_LOG_ERR,
+	ODP_LOG_UNIMPLEMENTED,
+	ODP_LOG_ABORT,
+	ODP_LOG_PRINT
+} odp_log_level_e;
+
+/**
+ * ODP log function
+ *
+ * Instead of direct prints to stdout/stderr all logging in an ODP
+ * implementation should be done via this function or its wrappers.
+ *
+ * The application can provide this function to the ODP implementation in two
+ * ways:
+ *
+ * - A callback passed in via in odp_init_t and odp_init_global()
+ * - By overriding the ODP implementation default log function
+ * odp_override_log().
+ *
+ * @warning The latter option is less portable and GNU linker dependent
+ * (utilizes function attribute "weak"). If both are defined, the odp_init_t
+ * function pointer has priority over the override function.
+ *
+ * @param[in] level   Log level
+ * @param[in] fmt     printf-style message format
+ *
+ * @return The number of characters logged if succeeded. Otherwise returns
+ *         a negative number.
+ */
+int odp_override_log(odp_log_level_e level, const char *fmt, ...);
+
+
+/** Replaceable logging function */
+typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...);
+
 /** ODP initialization data.
  * Data that is required to initialize the ODP API with the
  * application specific data such as specifying a logging callback, the log
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 7401a30..07c9f60 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -18,7 +18,7 @@ 
 extern "C" {
 #endif
 
-#include <odp_debug.h>
+#include <odp_init.h>
 
 struct odp_global_data {
 	odp_log_func_t log_fn;