diff mbox

[2/4] linux-generic: allow init_global to replace log fn

Message ID 1421632584-26181-3-git-send-email-mike.holmes@linaro.org
State Superseded
Headers show

Commit Message

Mike Holmes Jan. 19, 2015, 1:56 a.m. UTC
Add the ability to pass in a new logging function as a pointer to
init_global

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/api/odp_init.h | 3 ++-
 platform/linux-generic/odp_init.c             | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
index 22ed88d..73c4a3b 100644
--- a/platform/linux-generic/include/api/odp_init.h
+++ b/platform/linux-generic/include/api/odp_init.h
@@ -29,7 +29,7 @@  extern "C" {
 
 
 #include <odp_std_types.h>
-
+#include <odp_debug.h>
 
 /** @defgroup odp_initialization ODP INITIALIZATION
  *  Initialisation operations.
@@ -42,6 +42,7 @@  extern "C" {
  * level etc.
  */
 typedef struct odp_init_t {
+	odp_log_func_t log_fn;
 } odp_init_t;
 
 /** ODP platform initialization data.
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index a9f003f..c1539cf 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -15,6 +15,12 @@  int odp_init_global(odp_init_t *params  ODP_UNUSED,
 {
 	odp_global_data.log_fn = odp_override_log;
 
+	if (params != NULL) {
+		if (params->log_fn != NULL)
+			odp_global_data.log_fn = params->log_fn;
+	}
+
+
 	odp_system_info_init();
 
 	if (odp_shm_init_global()) {