From 6dc9533f4ce0743cd0834937513a8fd308e70f16 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Thu, 23 Feb 2017 20:24:52 +0900 Subject: Use macro for debug log Change-Id: I7edcefa0d77ac95fac8c3b4af222199c56f6ef59 --- src/include/mm_radio_utils.h | 16 ++++++++-------- src/mm_radio.c | 7 +++---- src/mm_radio_priv_emulator.c | 21 ++++++++++----------- src/mm_radio_priv_hal.c | 17 ++++++++--------- 4 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/include/mm_radio_utils.h b/src/include/mm_radio_utils.h index 3f70f29..32bc957 100644 --- a/src/include/mm_radio_utils.h +++ b/src/include/mm_radio_utils.h @@ -61,7 +61,7 @@ do { \ #define MMRADIO_CHECK_INSTANCE(x_radio) \ do { \ if (!x_radio) { \ - debug_error("radio instance is NULL\n"); \ + MMRADIO_LOG_ERROR("radio instance is NULL\n"); \ return MM_ERROR_RADIO_NOT_INITIALIZED; \ } \ } while (0) @@ -69,7 +69,7 @@ do { \ #define MMRADIO_CHECK_ARG(x_radio) \ do { \ if (!x_radio) { \ - debug_error("argument is NULL\n"); \ + MMRADIO_LOG_ERROR("argument is NULL\n"); \ return MM_ERROR_COMMON_INVALID_ARGUMENT; \ } \ } while (0) @@ -78,7 +78,7 @@ do { \ #define MMRADIO_CHECK_INSTANCE_RETURN_VOID(x_radio) \ do { \ if (!x_radio) { \ - debug_error("radio instance is NULL\n"); \ + MMRADIO_LOG_ERROR("radio instance is NULL\n"); \ return; \ } \ } while (0) @@ -86,7 +86,7 @@ do { \ #define MMRADIO_CHECK_DEVICE_STATE(x_radio) \ do { \ if (x_radio->radio_fd < 0) { \ - debug_error("not available radio device\n"); \ + MMRADIO_LOG_ERROR("not available radio device\n"); \ return MM_ERROR_RADIO_NOT_INITIALIZED; \ } \ } while (0) @@ -101,21 +101,21 @@ do { \ /* message posting */ #define MMRADIO_POST_MSG(x_radio, x_msgtype, x_msg_param) \ do { \ - debug_log("posting %s to application\n", #x_msgtype); \ + MMRADIO_LOG_DEBUG("posting %s to application\n", #x_msgtype); \ __mmradio_post_message(x_radio, x_msgtype, x_msg_param); \ } while (0) /* setting radio state */ #define MMRADIO_SET_STATE(x_radio, x_state) \ do { \ - debug_log("setting mm-radio state to %d\n", x_state); \ + MMRADIO_LOG_DEBUG("setting mm-radio state to %d\n", x_state); \ __mmradio_set_state(x_radio, x_state); \ } while (0) /* state */ #define MMRADIO_CHECK_STATE_RETURN_IF_FAIL(x_radio, x_command) \ do { \ - debug_log("checking radio state before doing %s\n", #x_command); \ + MMRADIO_LOG_DEBUG("checking radio state before doing %s\n", #x_command); \ switch (__mmradio_check_state(x_radio, x_command)) { \ case MM_ERROR_RADIO_INVALID_STATE: \ return MM_ERROR_RADIO_INVALID_STATE; \ @@ -132,7 +132,7 @@ do { \ #define MMRADIO_CHECK_RETURN_IF_FAIL(x_ret, x_msg) \ do { \ if (x_ret < 0) { \ - debug_error("%s error\n", x_msg); \ + MMRADIO_LOG_ERROR("%s error\n", x_msg); \ return x_ret; \ } \ } while (0); diff --git a/src/mm_radio.c b/src/mm_radio.c index becf05d..b1e17b0 100644 --- a/src/mm_radio.c +++ b/src/mm_radio.c @@ -34,7 +34,6 @@ #include "mm_radio_priv.h" #endif #include "mm_radio_utils.h" -#include "mm_debug.h" /*=========================================================================================== | | @@ -96,7 +95,7 @@ int mm_radio_create(MMHandleType *hradio) /* alloc radio structure */ new_radio = (mm_radio_t *)malloc(sizeof(mm_radio_t)); if (!new_radio) { - debug_critical("cannot allocate memory for radio\n"); + MMRADIO_LOG_CRITICAL("cannot allocate memory for radio\n"); goto ERROR; } memset(new_radio, 0, sizeof(mm_radio_t)); @@ -105,7 +104,7 @@ int mm_radio_create(MMHandleType *hradio) result = _mmradio_create_radio(new_radio); if (result != MM_ERROR_NONE) { - debug_error("radio creation failed\n"); + MMRADIO_LOG_ERROR("radio creation failed\n"); goto ERROR; } @@ -140,7 +139,7 @@ int mm_radio_destroy(MMHandleType hradio) result = _mmradio_destroy(radio); if (result != MM_ERROR_NONE) - debug_error("failed to destroy radio\n"); + MMRADIO_LOG_ERROR("failed to destroy radio\n"); /* free radio */ MMRADIO_FREEIF(radio); diff --git a/src/mm_radio_priv_emulator.c b/src/mm_radio_priv_emulator.c index 633d8a7..19d5c6b 100644 --- a/src/mm_radio_priv_emulator.c +++ b/src/mm_radio_priv_emulator.c @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -301,7 +300,7 @@ int _mmradio_realize(mm_radio_t * radio) #ifdef USE_GST_PIPELINE ret = _mmradio_realize_pipeline(radio); if (ret) { - debug_error("_mmradio_realize_pipeline is failed\n"); + MMRADIO_LOG_ERROR("_mmradio_realize_pipeline is failed\n"); return ret; } #endif @@ -600,7 +599,7 @@ int _mmradio_start(mm_radio_t * radio) #ifdef USE_GST_PIPELINE ret = _mmradio_start_pipeline(radio); if (ret) { - debug_error("_mmradio_start_pipeline is failed\n"); + MMRADIO_LOG_ERROR("_mmradio_start_pipeline is failed\n"); return ret; } #endif @@ -639,7 +638,7 @@ int _mmradio_stop(mm_radio_t * radio) #ifdef USE_GST_PIPELINE ret = _mmradio_stop_pipeline(radio); if (ret) { - debug_error("_mmradio_stop_pipeline is failed\n"); + MMRADIO_LOG_ERROR("_mmradio_stop_pipeline is failed\n"); return ret; } #endif @@ -1075,7 +1074,7 @@ static bool __mmradio_post_message(mm_radio_t * radio, enum MMMessageType msgtyp MMRADIO_LOG_FENTER(); if (!radio->msg_cb) { - debug_warning("failed to post a message\n"); + MMRADIO_LOG_WARNING("failed to post a message\n"); return false; } @@ -1207,13 +1206,13 @@ static int __mmradio_check_state(mm_radio_t * radio, MMRadioCommand command) return MM_ERROR_NONE; - INVALID_STATE: - debug_warning("invalid state. current : %d command : %d\n", radio_state, command); +INVALID_STATE: + MMRADIO_LOG_WARNING("invalid state. current : %d command : %d\n", radio_state, command); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_INVALID_STATE; - NO_OP: - debug_warning("mm-radio is in the desired state(%d). doing noting\n", radio_state); +NO_OP: + MMRADIO_LOG_WARNING("mm-radio is in the desired state(%d). doing noting\n", radio_state); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_NO_OP; @@ -1227,12 +1226,12 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state) MMRADIO_LOG_FENTER(); if (!radio) { - debug_warning("calling set_state with invalid radio handle\n"); + MMRADIO_LOG_WARNING("calling set_state with invalid radio handle\n"); return false; } if (radio->current_state == new_state && radio->pending_state == 0) { - debug_warning("we are in same state\n"); + MMRADIO_LOG_WARNING("we are in same state\n"); return true; } diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c index e9752ae..0ccd884 100644 --- a/src/mm_radio_priv_hal.c +++ b/src/mm_radio_priv_hal.c @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -859,7 +858,7 @@ int _mm_radio_get_signal_strength(mm_radio_t *radio, int *value) if (ret == MM_ERROR_NOT_SUPPORT_API) { MMRADIO_LOG_WARNING("radio_hal_unmute is not supported"); } else if (ret != MM_ERROR_NONE) { - debug_error("radio_hal_get_signal_strength error"); + MMRADIO_LOG_ERROR("radio_hal_get_signal_strength error"); *value = 0; MMRADIO_LOG_FLEAVE(); return ret; @@ -1129,7 +1128,7 @@ static bool __mmradio_post_message(mm_radio_t *radio, enum MMMessageType msgtype MMRADIO_LOG_FENTER(); if (!radio->msg_cb) { - debug_warning("failed to post a message"); + MMRADIO_LOG_WARNING("failed to post a message"); return false; } @@ -1263,13 +1262,13 @@ static int __mmradio_check_state(mm_radio_t *radio, MMRadioCommand command) return MM_ERROR_NONE; - INVALID_STATE: - debug_warning("invalid state. current : %d command : %d", radio_state, command); +INVALID_STATE: + MMRADIO_LOG_WARNING("invalid state. current : %d command : %d", radio_state, command); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_INVALID_STATE; - NO_OP: - debug_warning("mm-radio is in the desired state(%d). doing noting", radio_state); +NO_OP: + MMRADIO_LOG_WARNING("mm-radio is in the desired state(%d). doing noting", radio_state); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_NO_OP; @@ -1283,12 +1282,12 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state) MMRADIO_LOG_FENTER(); if (!radio) { - debug_warning("calling set_state with invalid radio handle"); + MMRADIO_LOG_WARNING("calling set_state with invalid radio handle"); return false; } if (radio->current_state == new_state && radio->pending_state == 0) { - debug_warning("we are in same state"); + MMRADIO_LOG_WARNING("we are in same state"); return true; } -- cgit v1.2.3