diff --git a/devicemodel/hw/platform/ioc.c b/devicemodel/hw/platform/ioc.c index 7055016e3..c0e899c2b 100644 --- a/devicemodel/hw/platform/ioc.c +++ b/devicemodel/hw/platform/ioc.c @@ -69,22 +69,12 @@ #include "ioc.h" #include "vmmapi.h" #include "monitor.h" +#include "log.h" -/* For debugging log to a file */ static int ioc_debug; -static FILE *dbg_file; -#define IOC_LOG_INIT do { if (ioc_debug) {\ - dbg_file = fopen("/tmp/ioc_log", "w+");\ -if (!dbg_file)\ - printf("ioc log open failed\r\n"); else cbc_set_log_file(dbg_file);\ -} } while (0) -#define IOC_LOG_DEINIT do { if (dbg_file) fclose(dbg_file); dbg_file = NULL;\ -cbc_set_log_file(dbg_file);\ -} while (0) #define DPRINTF(format, arg...) \ -do { if (ioc_debug && dbg_file) { fprintf(dbg_file, format, arg);\ - fflush(dbg_file); } } while (0) -#define WPRINTF(format, arg...) printf(format, ##arg) +do { if (ioc_debug) { pr_dbg(format, arg); } } while (0) +#define WPRINTF(format, arg...) pr_err(format, ##arg) /* * For debugging only, to generate lifecycle, signal and oem-raw data @@ -1528,8 +1518,6 @@ ioc_init(struct vmctx *ctx) int rc; struct ioc_dev *ioc; - IOC_LOG_INIT; - if (ioc_is_platform_supported() != 0) goto ioc_err; @@ -1695,7 +1683,6 @@ alloc_err: free(ioc->pool); free(ioc); ioc_err: - IOC_LOG_DEINIT; DPRINTF("%s", "ioc mediator startup failed!!\r\n"); return -1; } @@ -1720,7 +1707,6 @@ ioc_deinit(struct vmctx *ctx) free(ioc->evts); free(ioc->pool); free(ioc); - IOC_LOG_DEINIT; ctx->ioc_dev = NULL; } diff --git a/devicemodel/hw/platform/ioc_cbc.c b/devicemodel/hw/platform/ioc_cbc.c index 2388c34ac..1ae71ad80 100644 --- a/devicemodel/hw/platform/ioc_cbc.c +++ b/devicemodel/hw/platform/ioc_cbc.c @@ -13,16 +13,15 @@ #include "ioc.h" #include "monitor.h" +#include "log.h" /* * Debug printf */ static int ioc_cbc_debug; -static FILE *dbg_file; #define DPRINTF(format, arg...) \ -do { if (ioc_cbc_debug && dbg_file) { fprintf(dbg_file, format, arg);\ - fflush(dbg_file); } } while (0) -#define WPRINTF(format, arg...) printf(format, ##arg) +do { if (ioc_cbc_debug) { pr_dbg(format, arg); } } while (0) +#define WPRINTF(format, arg...) pr_err(format, ##arg) static void cbc_send_pkt(struct cbc_pkt *pkt); @@ -1018,12 +1017,3 @@ wlist_init_signal(struct cbc_signal *cbc_tbl, size_t cbc_size, } } } - -/* - * Share log file with IOC. - */ -void -cbc_set_log_file(FILE *f) -{ - dbg_file = f; -}