diff options
| author | Mister Oyster <oysterized@gmail.com> | 2017-04-17 20:09:21 +0200 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-25 11:28:18 +0200 |
| commit | a24af43108a25e9bedb15db17955685787d76dae (patch) | |
| tree | 14aff4bf1349c73c4fe96c128346c22418746e70 | |
| parent | 1016aa0eb6db78bd15c26e1d62e3a3e4856436bf (diff) | |
| download | android_kernel_m2note-a24af43108a25e9bedb15db17955685787d76dae.tar.gz | |
drivers: mtk: conn_md: backport from 3.18
| -rw-r--r-- | drivers/misc/mediatek/conn_md/conn_md.c | 74 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/conn_md_dbg.c | 47 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/conn_md_dump.c | 27 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/conn_md_exp.c | 9 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/conn_md_log.c | 14 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/conn_md_test.c | 22 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/include/conn_md.h | 7 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/include/conn_md_dbg.h | 5 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/include/conn_md_dump.h | 8 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/include/conn_md_exp.h | 8 | ||||
| -rw-r--r-- | drivers/misc/mediatek/conn_md/include/conn_md_log.h | 4 |
11 files changed, 65 insertions, 160 deletions
diff --git a/drivers/misc/mediatek/conn_md/conn_md.c b/drivers/misc/mediatek/conn_md/conn_md.c index 63ced4525..8d15453fd 100644 --- a/drivers/misc/mediatek/conn_md/conn_md.c +++ b/drivers/misc/mediatek/conn_md/conn_md.c @@ -9,7 +9,6 @@ CONN_MD_STRUCT g_conn_md; static int _conn_md_del_msg_by_uid(uint32 u_id); static int conn_md_dmp_msg(P_CONN_MD_QUEUE p_msg_list, uint32 src_id, uint32 dst_id); - int conn_md_add_user(uint32 u_id, CONN_MD_BRIDGE_OPS *p_ops) { P_CONN_MD_USER p_user = NULL; @@ -26,8 +25,7 @@ int conn_md_add_user(uint32 u_id, CONN_MD_BRIDGE_OPS *p_ops) if (p_user->u_id == u_id) { /*if yes */ /*print warning information */ - CONN_MD_WARN_FUNC - ("uid (0x%08x) is already registered, updating with newer one\n", u_id); + CONN_MD_WARN_FUNC("uid (0x%08x) is already registered, updating with newer one\n", u_id); break; } p_user = NULL; @@ -122,10 +120,8 @@ int conn_md_dmp_msg(P_CONN_MD_QUEUE p_msg_list, uint32 src_id, uint32 dst_id) counter++; CONN_MD_INFO_FUNC ("p_msg:0x%08x, src_id:0x%08x, dest_id:0x%08x, msg_len:%d\n", p_msg, - p_msg->ilm.src_mod_id, p_msg->ilm.dest_mod_id, - p_msg->local_para.msg_len); - for (i = 0; (i < p_msg->local_para.msg_len) && (i < MAX_LENGTH_PER_PACKAGE); - i++) { + p_msg->ilm.src_mod_id, p_msg->ilm.dest_mod_id, p_msg->local_para.msg_len); + for (i = 0; (i < p_msg->local_para.msg_len) && (i < MAX_LENGTH_PER_PACKAGE); i++) { CONN_MD_INFO_FUNC("%02x ", p_msg->local_para.data[i]); if (7 == (i % 8)) CONN_MD_INFO_FUNC("\n"); @@ -140,7 +136,6 @@ int conn_md_dmp_msg(P_CONN_MD_QUEUE p_msg_list, uint32 src_id, uint32 dst_id) return 0; } - int _conn_md_del_msg_by_uid(uint32 u_id) { /*only delete messaged enqueued in queue list, do not care message in active queue list */ @@ -149,6 +144,7 @@ int _conn_md_del_msg_by_uid(uint32 u_id) struct list_head *pos = NULL; P_CONN_MD_MSG p_msg = NULL; int flag = 1; + CONN_MD_TRC_FUNC(); mutex_lock(&p_msg_list->lock); while (flag) { @@ -170,8 +166,7 @@ int _conn_md_del_msg_by_uid(uint32 u_id) p_msg_list->counter--; list_del(pos); kfree(p_msg); - CONN_MD_DBG_FUNC("dequeued in queue list, counter:%d\n", - p_msg_list->counter); + CONN_MD_DBG_FUNC("dequeued in queue list, counter:%d\n", p_msg_list->counter); } } @@ -180,7 +175,6 @@ int _conn_md_del_msg_by_uid(uint32 u_id) return 0; } - int conn_md_send_msg(ipc_ilm_t *ilm) { @@ -209,8 +203,7 @@ int conn_md_send_msg(ipc_ilm_t *ilm) /*copy data from local_para_ptr structure */ memcpy(p_local_para->data, ilm->local_para_ptr->data, msg_info_len); - CONN_MD_DBG_FUNC("p_local_para:0x%08x, msg_len:%d\n", p_local_para, - p_local_para->msg_len); + CONN_MD_DBG_FUNC("p_local_para:0x%08x, msg_len:%d\n", p_local_para, p_local_para->msg_len); INIT_LIST_HEAD(&p_new_msg->entry); @@ -225,8 +218,7 @@ int conn_md_send_msg(ipc_ilm_t *ilm) mutex_unlock(&p_msg_list->lock); CONN_MD_DBG_FUNC - ("enqueue new message to msg queue list succeed, enqueued msg counter:%d\n", - p_msg_list->counter); + ("enqueue new message to msg queue list succeed, enqueued msg counter:%d\n", p_msg_list->counter); conn_md_dmp_in(ilm, MSG_ENQUEUE, p_conn_md->p_msg_dmp_sys); @@ -243,7 +235,6 @@ int conn_md_send_msg(ipc_ilm_t *ilm) return 0; } - #define ACT_QUEUE_DBG 0 static int conn_md_thread(void *p_data) @@ -300,8 +291,7 @@ static int conn_md_thread(void *p_data) kfree(p_msg); p_act_queue->counter++; - CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", - p_act_queue->counter); + CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", p_act_queue->counter); #endif continue; } @@ -313,11 +303,9 @@ static int conn_md_thread(void *p_data) /*check if src module is enabled or not */ list_for_each(p_user_pos, &p_user_list->list) { p_user = container_of(p_user_pos, CONN_MD_USER, entry); - if (p_user->u_id == p_cur_ilm->src_mod_id - && p_user->state == USER_ENABLED) { + if (p_user->u_id == p_cur_ilm->src_mod_id && p_user->state == USER_ENABLED) { /*src module id is enabled already */ - CONN_MD_DBG_FUNC("source user id (0x%08x) found\n", - p_cur_ilm->src_mod_id); + CONN_MD_DBG_FUNC("source user id (0x%08x) found\n", p_cur_ilm->src_mod_id); break; } p_user = NULL; @@ -333,8 +321,7 @@ static int conn_md_thread(void *p_data) list_del(pos); kfree(p_msg); p_act_queue->counter++; - CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", - p_act_queue->counter); + CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", p_act_queue->counter); #endif continue; @@ -343,10 +330,8 @@ static int conn_md_thread(void *p_data) /*check if destination module is enabled or not */ list_for_each(p_user_pos, &p_user_list->list) { p_user = container_of(p_user_pos, CONN_MD_USER, entry); - if (p_user->u_id == p_cur_ilm->dest_mod_id - && p_user->state == USER_ENABLED) { - CONN_MD_DBG_FUNC("target user id (0x%08x) found\n", - p_cur_ilm->dest_mod_id); + if (p_user->u_id == p_cur_ilm->dest_mod_id && p_user->state == USER_ENABLED) { + CONN_MD_DBG_FUNC("target user id (0x%08x) found\n", p_cur_ilm->dest_mod_id); /*src module id is enabled already */ break; } @@ -364,20 +349,16 @@ static int conn_md_thread(void *p_data) list_del(pos); kfree(p_msg); p_act_queue->counter++; - CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", - p_act_queue->counter); + CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", p_act_queue->counter); #endif continue; } CONN_MD_DBG_FUNC("p_cur_ilm:0x%08x, local_para_ptr:0x%08x, msg_len:%d\n", - p_cur_ilm, &p_cur_ilm->local_para_ptr, - p_cur_ilm->local_para_ptr->msg_len); - CONN_MD_DBG_FUNC("sending message to user id (0x%08x)\n", - p_cur_ilm->dest_mod_id); + p_cur_ilm, &p_cur_ilm->local_para_ptr, p_cur_ilm->local_para_ptr->msg_len); + CONN_MD_DBG_FUNC("sending message to user id (0x%08x)\n", p_cur_ilm->dest_mod_id); /*send package to dest module by call corresponding rx callback function */ (*(p_user->ops.rx_cb)) (p_cur_ilm); - CONN_MD_DBG_FUNC("message sent to user id (0x%08x) done\n", - p_cur_ilm->dest_mod_id); + CONN_MD_DBG_FUNC("message sent to user id (0x%08x) done\n", p_cur_ilm->dest_mod_id); mutex_unlock(&p_user_list->lock); #if (ACT_QUEUE_DBG == 1) @@ -387,8 +368,7 @@ static int conn_md_thread(void *p_data) CONN_MD_DBG_FUNC("message structure freed\n"); p_act_queue->counter++; - CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", - p_act_queue->counter); + CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", p_act_queue->counter); #endif } p_msg = NULL; @@ -396,15 +376,14 @@ static int conn_md_thread(void *p_data) while (!list_empty(&p_act_queue->list)) { list_for_each(pos, &p_act_queue->list) { p_msg = container_of(pos, CONN_MD_MSG, entry); - /*free message structure*/ + /*free message structure */ list_del(pos); kfree(p_msg); p_msg = NULL; CONN_MD_DBG_FUNC("message structure freed\n"); p_act_queue->counter++; - CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", - p_act_queue->counter); + CONN_MD_DBG_FUNC("dequeued in act queue counter:%d\n", p_act_queue->counter); break; } @@ -422,19 +401,16 @@ int conn_md_dmp_msg_queued(uint32 src_id, uint32 dst_id) return conn_md_dmp_msg(&g_conn_md.msg_queue, src_id, dst_id); } - int conn_md_dmp_msg_active(uint32 src_id, uint32 dst_id) { return conn_md_dmp_msg(&g_conn_md.act_queue, src_id, dst_id); } - int conn_md_dmp_msg_logged(uint32 src_id, uint32 dst_id) { return conn_md_dmp_out(g_conn_md.p_msg_dmp_sys, src_id, dst_id); } - static int conn_md_init(void) { int i_ret = -1; @@ -465,11 +441,10 @@ static int conn_md_init(void) CONN_MD_INFO_FUNC("init user information list succeed\n"); g_conn_md.p_msg_dmp_sys = conn_md_dmp_init(); - if (NULL == g_conn_md.p_msg_dmp_sys) { + if (NULL == g_conn_md.p_msg_dmp_sys) CONN_MD_WARN_FUNC("conn_md_dmp_init failed\n"); - } else { + else CONN_MD_INFO_FUNC("conn_md_dmp_init succeed\n"); - } /*init proc interface */ conn_md_dbg_init(); @@ -486,7 +461,7 @@ static int conn_md_init(void) /*wakeup conn_md_thread */ wake_up_process(g_conn_md.p_task); - conn_md_err: +conn_md_err: CONN_MD_TRC_FUNC(); return i_ret; @@ -549,11 +524,8 @@ static void conn_md_exit(void) conn_md_dmp_deinit(p_conn_md->p_msg_dmp_sys); CONN_MD_TRC_FUNC(); - - return; } - /*---------------------------------------------------------------------------*/ module_init(conn_md_init); diff --git a/drivers/misc/mediatek/conn_md/conn_md_dbg.c b/drivers/misc/mediatek/conn_md/conn_md_dbg.c index 274a2d704..2515c5b33 100644 --- a/drivers/misc/mediatek/conn_md/conn_md_dbg.c +++ b/drivers/misc/mediatek/conn_md/conn_md_dbg.c @@ -6,20 +6,14 @@ #include "conn_md.h" #include <linux/version.h> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) -#define USE_NEW_PROC_FS_FLAG 1 -#else -#define USE_NEW_PROC_FS_FLAG 0 -#endif +#define USE_NEW_PROC_FS_FLAG 1 #define CONN_MD_DBG_PROCNAME "driver/conn_md_dbg" static struct proc_dir_entry *gConnMdDbgEntry; #if USE_NEW_PROC_FS_FLAG -ssize_t conn_md_dbg_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos); -ssize_t conn_md_dbg_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos); -static struct file_operations conn_md_dbg_fops = { +static const struct file_operations conn_md_dbg_fops = { .read = conn_md_dbg_read, .write = conn_md_dbg_write, }; @@ -29,24 +23,18 @@ static int conn_md_test_dbg(int par1, int par2, int par3); static int conn_md_dbg_set_log_lvl(int par1, int par2, int par3); static int conn_md_dbg_dmp_msg_log(int par1, int par2, int par3); - - - - -const static CONN_MD_DEV_DBG_FUNC conn_md_dbg_func[] = { +static const CONN_MD_DEV_DBG_FUNC conn_md_dbg_func[] = { conn_md_test_dbg, conn_md_dbg_set_log_lvl, conn_md_dbg_dmp_msg_log, NULL, }; - int conn_md_dbg_dmp_msg_log(int par1, int par2, int par3) { return conn_md_dmp_msg_logged(par2, par3); } - int conn_md_dbg_set_log_lvl(int par1, int par2, int par3) { return conn_md_log_set_lvl(par2); @@ -67,8 +55,7 @@ static int conn_md_dbg_read(char *page, char **start, off_t off, int count, int #endif #if USE_NEW_PROC_FS_FLAG -ssize_t conn_md_dbg_write(struct file *filp, const char __user *buffer, size_t count, - loff_t *f_pos) +ssize_t conn_md_dbg_write(struct file *filp, const char __user *buffer, size_t count, loff_t *f_pos) #else static int conn_md_dbg_write(struct file *file, const char *buffer, unsigned long count, void *data) #endif @@ -90,35 +77,31 @@ static int conn_md_dbg_write(struct file *file, const char *buffer, unsigned lon return -1; } - if (copy_from_user(buf, buffer, len)) { + if (copy_from_user(buf, buffer, len)) return -EFAULT; - } buf[len] = '\0'; CONN_MD_INFO_FUNC("write parameter data = %s\n\r", buf); pBuf = buf; pToken = strsep(&pBuf, pDelimiter); - x = NULL != pToken ? simple_strtol(pToken, NULL, 16) : 0; + x = NULL != pToken ? kstrtol(pToken, NULL, 16) : 0; pToken = strsep(&pBuf, "\t\n "); if (pToken != NULL) { - y = simple_strtol(pToken, NULL, 16); + y = kstrtol(pToken, NULL, 16); CONN_MD_INFO_FUNC("y = 0x%08x\n\r", y); } pToken = strsep(&pBuf, "\t\n "); - if (pToken != NULL) { - z = simple_strtol(pToken, NULL, 16); - } - + if (pToken != NULL) + z = kstrtol(pToken, NULL, 16); CONN_MD_INFO_FUNC("x(0x%08x), y(0x%08x), z(0x%08x)\n\r", x, y, z); - if (ARRAY_SIZE(conn_md_dbg_func) > x && NULL != conn_md_dbg_func[x]) { + if (ARRAY_SIZE(conn_md_dbg_func) > x && NULL != conn_md_dbg_func[x]) (*conn_md_dbg_func[x]) (x, y, z); - } else { + else CONN_MD_WARN_FUNC("no handler defined for command id(0x%08x)\n\r", x); - } return len; } @@ -127,9 +110,6 @@ int conn_md_test_dbg(int par1, int par2, int par3) return conn_md_test(); } - - - int conn_md_dbg_init(void) { #if USE_NEW_PROC_FS_FLAG @@ -152,14 +132,12 @@ int conn_md_dbg_init(void) } - int conn_md_dbg_deinit(void) { #if USE_NEW_PROC_FS_FLAG - if (NULL != gConnMdDbgEntry) { + if (NULL != gConnMdDbgEntry) proc_remove(gConnMdDbgEntry); - } #else if (gConnMdDbgEntry != NULL) { @@ -168,7 +146,6 @@ int conn_md_dbg_deinit(void) } #endif - return 0; } diff --git a/drivers/misc/mediatek/conn_md/conn_md_dump.c b/drivers/misc/mediatek/conn_md/conn_md_dump.c index 5c5a3e437..4669c3364 100644 --- a/drivers/misc/mediatek/conn_md/conn_md_dump.c +++ b/drivers/misc/mediatek/conn_md/conn_md_dump.c @@ -1,18 +1,16 @@ - #define DFT_TAG "[CONN_MD_DMP]" #include "conn_md_log.h" #include "conn_md_dump.h" - P_CONN_MD_DMP_MSG_LOG conn_md_dmp_init(void) { uint32 msg_log_size = sizeof(CONN_MD_DMP_MSG_LOG); P_CONN_MD_DMP_MSG_LOG p_msg_log = vmalloc(msg_log_size); + if (NULL != p_msg_log) { - CONN_MD_INFO_FUNC("alloc memory for msg log system done, size:0x%08x\n", - msg_log_size); + CONN_MD_INFO_FUNC("alloc memory for msg log system done, size:0x%08x\n", msg_log_size); memset(p_msg_log, 0, msg_log_size); mutex_init(&p_msg_log->lock); @@ -26,8 +24,9 @@ P_CONN_MD_DMP_MSG_LOG conn_md_dmp_init(void) int conn_md_dmp_deinit(P_CONN_MD_DMP_MSG_LOG p_log) { int i_ret = -1; + if (NULL != p_log) { - CONN_MD_INFO_FUNC("vaild log buffer pointer:0x%08x, free it.\n", p_log); + CONN_MD_INFO_FUNC("valid log buffer pointer:0x%08x, free it.\n", p_log); mutex_destroy(&p_log->lock); vfree(p_log); i_ret = 0; @@ -76,19 +75,17 @@ int __conn_md_dmp_in(ipc_ilm_t *p_ilm, CONN_MD_MSG_TYPE msg_type, P_CONN_MD_DMP_ p_msg_log->in %= NUMBER_OF_MSG_LOGGED; mutex_unlock(&p_msg_log->lock); - CONN_MD_WARN_FUNC("msg type:%d enqueued succeed\n", msg_type); + CONN_MD_DBG_FUNC("msg type:%d enqueued succeed\n", msg_type); return 0; } - int conn_md_dmp_in(ipc_ilm_t *p_ilm, CONN_MD_MSG_TYPE msg_type, P_CONN_MD_DMP_MSG_LOG p_msg_log) { int i_ret = -1; if (NULL == p_ilm || NULL == p_ilm->local_para_ptr || - 0 == p_ilm->local_para_ptr->msg_len || - (msg_type != MSG_ENQUEUE && msg_type != MSG_DEQUEUE)) { + 0 == p_ilm->local_para_ptr->msg_len || (msg_type != MSG_ENQUEUE && msg_type != MSG_DEQUEUE)) { CONN_MD_WARN_FUNC("invalid parameter\n"); i_ret = CONN_MD_ERR_INVALID_PARAM; } else { @@ -102,15 +99,13 @@ int __conn_md_dmp_msg_filter(P_CONN_MD_DMP_MSG_STR p_msg, uint32 src_id, uint32 ipc_ilm_t *p_ilm = &p_msg->ilm; int i = 0; - if (((0 == src_id) || (src_id == p_ilm->src_mod_id)) && - ((0 == dst_id) || (dst_id == p_ilm->dest_mod_id))) { + if (((0 == src_id) || (src_id == p_ilm->src_mod_id)) && ((0 == dst_id) || (dst_id == p_ilm->dest_mod_id))) { __conn_md_log_print(DFT_TAG "%d.%d s, <%s> src_id:0x%08x, dst_id:0x%08x, msg_len:%d, dump_len:%d:\n", p_msg->sec, p_msg->usec, (MSG_ENQUEUE == p_msg->type ? "enqueue" : "dequeue"), p_msg->ilm.src_mod_id, p_msg->ilm.dest_mod_id, p_msg->msg_len, - (LENGTH_PER_PACKAGE >= - p_msg->msg_len ? p_msg->msg_len : LENGTH_PER_PACKAGE)); + (LENGTH_PER_PACKAGE >= p_msg->msg_len ? p_msg->msg_len : LENGTH_PER_PACKAGE)); for (i = 0; (i < p_msg->msg_len) && (i < LENGTH_PER_PACKAGE); i++) { __conn_md_log_print("%02x ", p_msg->data[i]); @@ -122,7 +117,6 @@ int __conn_md_dmp_msg_filter(P_CONN_MD_DMP_MSG_STR p_msg, uint32 src_id, uint32 return 0; } - int conn_md_dmp_out(P_CONN_MD_DMP_MSG_LOG p_msg_log, uint32 src_id, uint32 dst_id) { int i_ret = 0; @@ -142,11 +136,10 @@ int conn_md_dmp_out(P_CONN_MD_DMP_MSG_LOG p_msg_log, uint32 src_id, uint32 dst_i return CONN_MD_ERR_INVALID_PARAM; } CONN_MD_INFO_FUNC("dump msg for <src_id:0x%08x, dst_id:0x%08x> start\n", src_id, dst_id); - if (NUMBER_OF_MSG_LOGGED == size) { + if (NUMBER_OF_MSG_LOGGED == size) out = in; - } else { + else out = 0; - } while (size--) { p_msg = &p_msg_log->msg[out]; diff --git a/drivers/misc/mediatek/conn_md/conn_md_exp.c b/drivers/misc/mediatek/conn_md/conn_md_exp.c index 8faf45ca8..db359b056 100644 --- a/drivers/misc/mediatek/conn_md/conn_md_exp.c +++ b/drivers/misc/mediatek/conn_md/conn_md_exp.c @@ -6,9 +6,6 @@ #include "conn_md.h" - - - int mtk_conn_md_bridge_reg(uint32 u_id, CONN_MD_BRIDGE_OPS *p_ops) { @@ -23,9 +20,9 @@ int mtk_conn_md_bridge_reg(uint32 u_id, CONN_MD_BRIDGE_OPS *p_ops) i_ret = CONN_MD_ERR_INVALID_PARAM; } - return i_ret; } +EXPORT_SYMBOL(mtk_conn_md_bridge_reg); int mtk_conn_md_bridge_unreg(uint32 u_id) { @@ -36,7 +33,7 @@ int mtk_conn_md_bridge_unreg(uint32 u_id) i_ret = conn_md_del_user(u_id); return 0; } - +EXPORT_SYMBOL(mtk_conn_md_bridge_unreg); int mtk_conn_md_bridge_send_msg(ipc_ilm_t *ilm) { int i_ret = -1; @@ -52,6 +49,4 @@ int mtk_conn_md_bridge_send_msg(ipc_ilm_t *ilm) return 0; } -EXPORT_SYMBOL(mtk_conn_md_bridge_reg); -EXPORT_SYMBOL(mtk_conn_md_bridge_unreg); EXPORT_SYMBOL(mtk_conn_md_bridge_send_msg); diff --git a/drivers/misc/mediatek/conn_md/conn_md_log.c b/drivers/misc/mediatek/conn_md/conn_md_log.c index 2909e252e..d7b91f92c 100644 --- a/drivers/misc/mediatek/conn_md/conn_md_log.c +++ b/drivers/misc/mediatek/conn_md/conn_md_log.c @@ -1,8 +1,6 @@ #include "conn_md_log.h" - -int g_conn_md_dbg_lvl = CONN_MD_LOG_DBG; /* CONN_MD_LOG_INFO; */ - +int g_conn_md_dbg_lvl = CONN_MD_LOG_INFO; /*Log defination*/ int __conn_md_log_print(const char *str, ...) @@ -14,14 +12,13 @@ int __conn_md_log_print(const char *str, ...) vsnprintf(temp_sring, DBG_LOG_STR_SIZE, str, args); va_end(args); - pr_err(KERN_ERR "%s", temp_sring); + pr_err("%s", temp_sring); /* print(KERN_INFO "%s",temp_sring); */ return 0; } - int __conn_md_get_log_lvl(void) { /* return CONN_MD_LOG_INFO; */ @@ -41,18 +38,15 @@ int conn_md_log_set_lvl(int log_lvl) g_conn_md_dbg_lvl = log_lvl; if (g_conn_md_dbg_lvl > CONN_MD_LOG_LOUD) { - CONN_MD_ERR_FUNC("log_lvl(%d) is too big, round to %d\n", log_lvl, - CONN_MD_LOG_LOUD); + CONN_MD_ERR_FUNC("log_lvl(%d) is too big, round to %d\n", log_lvl, CONN_MD_LOG_LOUD); g_conn_md_dbg_lvl = CONN_MD_LOG_LOUD; } if (g_conn_md_dbg_lvl < CONN_MD_LOG_ERR) { - CONN_MD_ERR_FUNC("log_lvl(%d) is too small, round to %d\n", log_lvl, - CONN_MD_LOG_ERR); + CONN_MD_ERR_FUNC("log_lvl(%d) is too small, round to %d\n", log_lvl, CONN_MD_LOG_ERR); g_conn_md_dbg_lvl = CONN_MD_LOG_ERR; } - return g_conn_md_dbg_lvl; } diff --git a/drivers/misc/mediatek/conn_md/conn_md_test.c b/drivers/misc/mediatek/conn_md/conn_md_test.c index f6ac4a04e..4ff175fb9 100644 --- a/drivers/misc/mediatek/conn_md/conn_md_test.c +++ b/drivers/misc/mediatek/conn_md/conn_md_test.c @@ -1,5 +1,4 @@ - #define DFT_TAG "[CONN_MD_EXP]" #include "conn_md_log.h" @@ -7,12 +6,8 @@ #include "conn_md.h" -extern int mtk_conn_md_bridge_reg(uint32 u_id, CONN_MD_BRIDGE_OPS *p_ops); -extern int mtk_conn_md_bridge_unreg(uint32 u_id); -extern int mtk_conn_md_bridge_send_msg(ipc_ilm_t *ilm); CONN_MD_BRIDGE_OPS g_ops; - static int conn_md_test_rx_cb(ipc_ilm_t *ilm); int conn_md_test(void) @@ -23,6 +18,7 @@ int conn_md_test(void) local_para_struct *p_buf_str; int i = 0; int msg_len = 0; + p_buf_str = kmalloc(sizeof(local_para_struct) + PACKAGE_SIZE, GFP_ATOMIC); if (NULL == p_buf_str) { CONN_MD_ERR_FUNC("kmalloc for local para ptr structure failed.\n"); @@ -36,7 +32,6 @@ int conn_md_test(void) g_ops.rx_cb = conn_md_test_rx_cb; - mtk_conn_md_bridge_reg(0x800001, &g_ops); mtk_conn_md_bridge_reg(0x800005, &g_ops); mtk_conn_md_bridge_reg(0x800009, &g_ops); @@ -123,27 +118,24 @@ int conn_md_test(void) conn_md_dmp_msg_logged(0, 0); conn_md_dmp_msg_logged(0x80000a, 0); - return 0; } - static int conn_md_test_rx_cb(ipc_ilm_t *ilm) { int i = 0; - pr_warn(KERN_WARNING "%s, ilm:0x%p\n", __func__, ilm); - pr_warn(KERN_WARNING "%s, ilm:src_id(%d), dst_id(%d), msg_id(%d)\n", __func__, + pr_warn("%s, ilm:0x%p\n", __func__, ilm); + pr_warn("%s, ilm:src_id(%d), dst_id(%d), msg_id(%d)\n", __func__, ilm->src_mod_id, ilm->dest_mod_id, ilm->msg_id); - pr_warn(KERN_WARNING "%s, local_para_ptr:0x%p, msg_len:%d\n", __func__, ilm->local_para_ptr, + pr_warn("%s, local_para_ptr:0x%p, msg_len:%d\n", __func__, ilm->local_para_ptr, ilm->local_para_ptr->msg_len); for (i = 0; i < ilm->local_para_ptr->msg_len; i++) { - pr_warn(KERN_WARNING "%d ", ilm->local_para_ptr->data[i]); - if ((0 != i) && (((1 + i) % 8) == 0)) { - pr_warn(KERN_WARNING "\n"); - } + pr_warn("%d ", ilm->local_para_ptr->data[i]); + if ((0 != i) && (((1 + i) % 8) == 0)) + pr_warn("\n"); } return 0; } diff --git a/drivers/misc/mediatek/conn_md/include/conn_md.h b/drivers/misc/mediatek/conn_md/include/conn_md.h index e26341b7d..c025c49d0 100644 --- a/drivers/misc/mediatek/conn_md/include/conn_md.h +++ b/drivers/misc/mediatek/conn_md/include/conn_md.h @@ -1,12 +1,9 @@ #ifndef __CONN_MD_H_ #define __CONN_MD_H_ - - #include "conn_md_exp.h" #include "conn_md_dump.h" - /*-----------------------Data Structure Definition-----------------------*/ typedef enum { @@ -25,21 +22,18 @@ typedef struct _CONN_MD_USER_ { struct list_head entry; } CONN_MD_USER, *P_CONN_MD_USER; - typedef struct _CONN_MD_MSG_ { ipc_ilm_t ilm; struct list_head entry; local_para_struct local_para; } CONN_MD_MSG, *P_CONN_MD_MSG; - typedef struct _CONN_MD_QUEUE_ { struct list_head list; struct mutex lock; uint32 counter; } CONN_MD_QUEUE, *P_CONN_MD_QUEUE; - typedef struct _CONN_MD_USER_LIST_ { uint32 counter; struct list_head list; @@ -65,5 +59,4 @@ extern int conn_md_dmp_msg_logged(uint32 src_id, uint32 dst_id); extern int conn_md_dmp_msg_active(uint32 src_id, uint32 dst_id); extern int conn_md_dmp_msg_queued(uint32 src_id, uint32 dst_id); - #endif diff --git a/drivers/misc/mediatek/conn_md/include/conn_md_dbg.h b/drivers/misc/mediatek/conn_md/include/conn_md_dbg.h index 922a80dc0..b9f799482 100644 --- a/drivers/misc/mediatek/conn_md/include/conn_md_dbg.h +++ b/drivers/misc/mediatek/conn_md/include/conn_md_dbg.h @@ -3,13 +3,14 @@ #ifdef ARRAY_SIZE #undef ARRAY_SIZE -#define ARRAY_SIZE(x) sizeof(x)/sizeof(x[0]) +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #endif typedef int (*CONN_MD_DEV_DBG_FUNC) (int par1, int par2, int par3); extern int conn_md_dbg_init(void); - extern int conn_md_test(void); +ssize_t conn_md_dbg_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos); +ssize_t conn_md_dbg_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos); #endif/*__CONN_MD_DBG_H_*/ diff --git a/drivers/misc/mediatek/conn_md/include/conn_md_dump.h b/drivers/misc/mediatek/conn_md/include/conn_md_dump.h index 9c3b783bb..b2378a901 100644 --- a/drivers/misc/mediatek/conn_md/include/conn_md_dump.h +++ b/drivers/misc/mediatek/conn_md/include/conn_md_dump.h @@ -7,14 +7,12 @@ #define LENGTH_PER_PACKAGE 8 #define NUMBER_OF_MSG_LOGGED 16 - typedef enum { MSG_ENQUEUE = 1, MSG_DEQUEUE = 2, MSG_EN_DE_QUEUE = 3, } CONN_MD_MSG_TYPE; - typedef struct _CONN_MD_DMP_MSG_STR_ { unsigned int sec; unsigned int usec; @@ -24,7 +22,6 @@ typedef struct _CONN_MD_DMP_MSG_STR_ { uint8 data[LENGTH_PER_PACKAGE]; } CONN_MD_DMP_MSG_STR, *P_CONN_MD_DMP_MSG_STR; - typedef struct _CONN_MD_DMP_MSG_LOG_ { CONN_MD_DMP_MSG_STR msg[NUMBER_OF_MSG_LOGGED]; @@ -35,13 +32,10 @@ typedef struct _CONN_MD_DMP_MSG_LOG_ { } CONN_MD_DMP_MSG_LOG, *P_CONN_MD_DMP_MSG_LOG; - extern P_CONN_MD_DMP_MSG_LOG conn_md_dmp_init(void); extern int conn_md_dmp_deinit(P_CONN_MD_DMP_MSG_LOG p_log); - -extern int conn_md_dmp_in(ipc_ilm_t *p_ilm, CONN_MD_MSG_TYPE msg_type, - P_CONN_MD_DMP_MSG_LOG p_msg_log); +extern int conn_md_dmp_in(ipc_ilm_t *p_ilm, CONN_MD_MSG_TYPE msg_type, P_CONN_MD_DMP_MSG_LOG p_msg_log); extern int conn_md_dmp_out(P_CONN_MD_DMP_MSG_LOG p_msg_log, uint32 src_id, uint32 dst_id); #endif diff --git a/drivers/misc/mediatek/conn_md/include/conn_md_exp.h b/drivers/misc/mediatek/conn_md/include/conn_md_exp.h index f1775c209..b669172e7 100644 --- a/drivers/misc/mediatek/conn_md/include/conn_md_exp.h +++ b/drivers/misc/mediatek/conn_md/include/conn_md_exp.h @@ -1,7 +1,6 @@ #ifndef __CONN_MD_EXP_H_ #define __CONN_MD_EXP_H_ - #if defined(CONFIG_MTK_ECCCI_DRIVER) || defined(CONFIG_MTK_ECCCI_DRIVER_MODULE) #include "port_ipc.h" /*data structure is defined here, mediatek/kernel/drivers/eccci */ #include "ccci_ipc_task_ID.h" /*IPC task id is defined here, mediatek/kernel/drivers/eccci */ @@ -28,7 +27,6 @@ typedef enum { } CONN_MD_ERR_CODE; - /*For IDC test*/ typedef int (*CONN_MD_MSG_RX_CB) (ipc_ilm_t *ilm); @@ -43,19 +41,19 @@ extern int mtk_conn_md_bridge_send_msg(ipc_ilm_t *ilm); #if 0 static int __weak mtk_conn_md_bridge_reg(uint32 u_id, CONN_MD_BRIDGE_OPS *p_ops) { - pr_err(KERN_ERR "MTK_CONN Weak FUNCTION~~~\n"); + pr_err("MTK_CONN Weak FUNCTION~~~\n"); return 0; } static int __weak mtk_conn_md_bridge_unreg(uint32 u_id) { - pr_err(KERN_ERR "MTK_CONN Weak FUNCTION~~~\n"); + pr_err("MTK_CONN Weak FUNCTION~~~\n"); return 0; } static int __weak mtk_conn_md_bridge_send_msg(ipc_ilm_t *ilm) { - pr_err(KERN_ERR "MTK_CONN Weak FUNCTION~~~\n"); + pr_err("MTK_CONN Weak FUNCTION~~~\n"); return 0; } #endif diff --git a/drivers/misc/mediatek/conn_md/include/conn_md_log.h b/drivers/misc/mediatek/conn_md/include/conn_md_log.h index f9a3e12ee..f968775af 100644 --- a/drivers/misc/mediatek/conn_md/include/conn_md_log.h +++ b/drivers/misc/mediatek/conn_md/include/conn_md_log.h @@ -1,7 +1,6 @@ #ifndef __CONN_MD_LOG_H_ #define __CONN_MD_LOG_H_ - #include <linux/module.h> #include <linux/types.h> #include <linux/mutex.h> @@ -28,8 +27,6 @@ #include <linux/proc_fs.h> #include <linux/kernel.h> - - #define DBG_LOG_STR_SIZE 512 extern int g_conn_md_dbg_lvl; @@ -90,5 +87,4 @@ do { \ __func__, __LINE__); \ } while (0) - #endif |
