Loading arch/arm/mach-msm/include/mach/msm_ipc_router.h +8 −6 Original line number Diff line number Diff line Loading @@ -18,10 +18,12 @@ #include <linux/errno.h> #include <linux/mm.h> #include <linux/list.h> #include <linux/wakelock.h> #include <linux/pm.h> #include <linux/msm_ipc.h> #include <linux/device.h> #define MAX_WAKELOCK_NAME_SZ 32 /* Maximum Wakeup Source Name Size */ #define MAX_WS_NAME_SZ 32 /** * enum msm_ipc_router_event - Events that will be generated by IPC Router Loading Loading @@ -80,8 +82,8 @@ struct comm_mode_info { * @mode_info: Communication mode of the port owner. * @port_rx_q: Receive queue where incoming messages are queued. * @port_rx_q_lock_lhb3: Lock to protect access to the port's rx_q. * @rx_wakelock_name: Name of the receive wakelock. * @port_rx_wake_lock: Wakelock to prevent suspend until the rx_q is empty. * @rx_ws_name: Name of the receive wakeup source. * @port_rx_ws: Wakeup source to prevent suspend until the rx_q is empty. * @port_rx_wait_q: Wait queue to wait for the incoming messages. * @restart_state: Flag to hold the restart state information. * @restart_lock: Lock to protect access to the restart_state. Loading @@ -107,8 +109,8 @@ struct msm_ipc_port { struct list_head port_rx_q; struct mutex port_rx_q_lock_lhb3; char rx_wakelock_name[MAX_WAKELOCK_NAME_SZ]; struct wake_lock port_rx_wake_lock; char rx_ws_name[MAX_WS_NAME_SZ]; struct wakeup_source port_rx_ws; wait_queue_head_t port_rx_wait_q; int restart_state; Loading arch/arm/mach-msm/ipc_router.c +11 −13 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include <linux/err.h> #include <linux/sched.h> #include <linux/poll.h> #include <linux/wakelock.h> #include <linux/pm.h> #include <linux/platform_device.h> #include <linux/uaccess.h> #include <linux/debugfs.h> Loading Loading @@ -157,7 +157,7 @@ struct msm_ipc_router_xprt_info { uint32_t remote_node_id; uint32_t initialized; struct list_head pkt_list; struct wake_lock wakelock; struct wakeup_source ws; struct mutex rx_lock_lhb2; struct mutex tx_lock_lhb2; uint32_t need_len; Loading Loading @@ -281,7 +281,7 @@ struct rr_packet *rr_read(struct msm_ipc_router_xprt_info *xprt_info) struct rr_packet, list); list_del(&temp_pkt->list); if (list_empty(&xprt_info->pkt_list)) wake_unlock(&xprt_info->wakelock); __pm_relax(&xprt_info->ws); mutex_unlock(&xprt_info->rx_lock_lhb2); return temp_pkt; } Loading Loading @@ -835,7 +835,7 @@ static int post_pkt_to_port(struct msm_ipc_port *port_ptr, } mutex_lock(&port_ptr->port_rx_q_lock_lhb3); wake_lock(&port_ptr->port_rx_wake_lock); __pm_stay_awake(&port_ptr->port_rx_ws); list_add_tail(&temp_pkt->list, &port_ptr->port_rx_q); wake_up(&port_ptr->port_rx_wait_q); notify = port_ptr->notify; Loading Loading @@ -946,12 +946,11 @@ struct msm_ipc_port *msm_ipc_router_create_raw_port(void *endpoint, INIT_LIST_HEAD(&port_ptr->port_rx_q); mutex_init(&port_ptr->port_rx_q_lock_lhb3); init_waitqueue_head(&port_ptr->port_rx_wait_q); snprintf(port_ptr->rx_wakelock_name, MAX_WAKELOCK_NAME_SZ, snprintf(port_ptr->rx_ws_name, MAX_WS_NAME_SZ, "ipc%08x_%s", port_ptr->this_port.port_id, current->comm); wake_lock_init(&port_ptr->port_rx_wake_lock, WAKE_LOCK_SUSPEND, port_ptr->rx_wakelock_name); wakeup_source_init(&port_ptr->port_rx_ws, port_ptr->rx_ws_name); port_ptr->endpoint = endpoint; port_ptr->notify = notify; Loading Loading @@ -2638,7 +2637,7 @@ int msm_ipc_router_read(struct msm_ipc_port *port_ptr, } list_del(&pkt->list); if (list_empty(&port_ptr->port_rx_q)) wake_unlock(&port_ptr->port_rx_wake_lock); __pm_relax(&port_ptr->port_rx_ws); *read_pkt = pkt; mutex_unlock(&port_ptr->port_rx_q_lock_lhb3); if (pkt->hdr.control_flag & CONTROL_FLAG_CONFIRM_RX) Loading Loading @@ -2878,7 +2877,7 @@ int msm_ipc_router_close_port(struct msm_ipc_port *port_ptr) up_write(&server_list_lock_lha2); } wake_lock_destroy(&port_ptr->port_rx_wake_lock); wakeup_source_trash(&port_ptr->port_rx_ws); kfree(port_ptr); return 0; } Loading Loading @@ -3221,8 +3220,7 @@ static int msm_ipc_router_add_xprt(struct msm_ipc_router_xprt *xprt) INIT_LIST_HEAD(&xprt_info->pkt_list); mutex_init(&xprt_info->rx_lock_lhb2); mutex_init(&xprt_info->tx_lock_lhb2); wake_lock_init(&xprt_info->wakelock, WAKE_LOCK_SUSPEND, xprt->name); wakeup_source_init(&xprt_info->ws, xprt->name); xprt_info->need_len = 0; xprt_info->abort_data_read = 0; INIT_WORK(&xprt_info->read_data, do_read_data); Loading Loading @@ -3274,7 +3272,7 @@ static void msm_ipc_router_remove_xprt(struct msm_ipc_router_xprt *xprt) flush_workqueue(xprt_info->workqueue); destroy_workqueue(xprt_info->workqueue); wake_lock_destroy(&xprt_info->wakelock); wakeup_source_trash(&xprt_info->ws); xprt->priv = 0; kfree(xprt_info); Loading Loading @@ -3369,7 +3367,7 @@ void msm_ipc_router_xprt_notify(struct msm_ipc_router_xprt *xprt, mutex_lock(&xprt_info->rx_lock_lhb2); list_add_tail(&pkt->list, &xprt_info->pkt_list); wake_lock(&xprt_info->wakelock); __pm_stay_awake(&xprt_info->ws); mutex_unlock(&xprt_info->rx_lock_lhb2); queue_work(xprt_info->workqueue, &xprt_info->read_data); } Loading Loading
arch/arm/mach-msm/include/mach/msm_ipc_router.h +8 −6 Original line number Diff line number Diff line Loading @@ -18,10 +18,12 @@ #include <linux/errno.h> #include <linux/mm.h> #include <linux/list.h> #include <linux/wakelock.h> #include <linux/pm.h> #include <linux/msm_ipc.h> #include <linux/device.h> #define MAX_WAKELOCK_NAME_SZ 32 /* Maximum Wakeup Source Name Size */ #define MAX_WS_NAME_SZ 32 /** * enum msm_ipc_router_event - Events that will be generated by IPC Router Loading Loading @@ -80,8 +82,8 @@ struct comm_mode_info { * @mode_info: Communication mode of the port owner. * @port_rx_q: Receive queue where incoming messages are queued. * @port_rx_q_lock_lhb3: Lock to protect access to the port's rx_q. * @rx_wakelock_name: Name of the receive wakelock. * @port_rx_wake_lock: Wakelock to prevent suspend until the rx_q is empty. * @rx_ws_name: Name of the receive wakeup source. * @port_rx_ws: Wakeup source to prevent suspend until the rx_q is empty. * @port_rx_wait_q: Wait queue to wait for the incoming messages. * @restart_state: Flag to hold the restart state information. * @restart_lock: Lock to protect access to the restart_state. Loading @@ -107,8 +109,8 @@ struct msm_ipc_port { struct list_head port_rx_q; struct mutex port_rx_q_lock_lhb3; char rx_wakelock_name[MAX_WAKELOCK_NAME_SZ]; struct wake_lock port_rx_wake_lock; char rx_ws_name[MAX_WS_NAME_SZ]; struct wakeup_source port_rx_ws; wait_queue_head_t port_rx_wait_q; int restart_state; Loading
arch/arm/mach-msm/ipc_router.c +11 −13 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ #include <linux/err.h> #include <linux/sched.h> #include <linux/poll.h> #include <linux/wakelock.h> #include <linux/pm.h> #include <linux/platform_device.h> #include <linux/uaccess.h> #include <linux/debugfs.h> Loading Loading @@ -157,7 +157,7 @@ struct msm_ipc_router_xprt_info { uint32_t remote_node_id; uint32_t initialized; struct list_head pkt_list; struct wake_lock wakelock; struct wakeup_source ws; struct mutex rx_lock_lhb2; struct mutex tx_lock_lhb2; uint32_t need_len; Loading Loading @@ -281,7 +281,7 @@ struct rr_packet *rr_read(struct msm_ipc_router_xprt_info *xprt_info) struct rr_packet, list); list_del(&temp_pkt->list); if (list_empty(&xprt_info->pkt_list)) wake_unlock(&xprt_info->wakelock); __pm_relax(&xprt_info->ws); mutex_unlock(&xprt_info->rx_lock_lhb2); return temp_pkt; } Loading Loading @@ -835,7 +835,7 @@ static int post_pkt_to_port(struct msm_ipc_port *port_ptr, } mutex_lock(&port_ptr->port_rx_q_lock_lhb3); wake_lock(&port_ptr->port_rx_wake_lock); __pm_stay_awake(&port_ptr->port_rx_ws); list_add_tail(&temp_pkt->list, &port_ptr->port_rx_q); wake_up(&port_ptr->port_rx_wait_q); notify = port_ptr->notify; Loading Loading @@ -946,12 +946,11 @@ struct msm_ipc_port *msm_ipc_router_create_raw_port(void *endpoint, INIT_LIST_HEAD(&port_ptr->port_rx_q); mutex_init(&port_ptr->port_rx_q_lock_lhb3); init_waitqueue_head(&port_ptr->port_rx_wait_q); snprintf(port_ptr->rx_wakelock_name, MAX_WAKELOCK_NAME_SZ, snprintf(port_ptr->rx_ws_name, MAX_WS_NAME_SZ, "ipc%08x_%s", port_ptr->this_port.port_id, current->comm); wake_lock_init(&port_ptr->port_rx_wake_lock, WAKE_LOCK_SUSPEND, port_ptr->rx_wakelock_name); wakeup_source_init(&port_ptr->port_rx_ws, port_ptr->rx_ws_name); port_ptr->endpoint = endpoint; port_ptr->notify = notify; Loading Loading @@ -2638,7 +2637,7 @@ int msm_ipc_router_read(struct msm_ipc_port *port_ptr, } list_del(&pkt->list); if (list_empty(&port_ptr->port_rx_q)) wake_unlock(&port_ptr->port_rx_wake_lock); __pm_relax(&port_ptr->port_rx_ws); *read_pkt = pkt; mutex_unlock(&port_ptr->port_rx_q_lock_lhb3); if (pkt->hdr.control_flag & CONTROL_FLAG_CONFIRM_RX) Loading Loading @@ -2878,7 +2877,7 @@ int msm_ipc_router_close_port(struct msm_ipc_port *port_ptr) up_write(&server_list_lock_lha2); } wake_lock_destroy(&port_ptr->port_rx_wake_lock); wakeup_source_trash(&port_ptr->port_rx_ws); kfree(port_ptr); return 0; } Loading Loading @@ -3221,8 +3220,7 @@ static int msm_ipc_router_add_xprt(struct msm_ipc_router_xprt *xprt) INIT_LIST_HEAD(&xprt_info->pkt_list); mutex_init(&xprt_info->rx_lock_lhb2); mutex_init(&xprt_info->tx_lock_lhb2); wake_lock_init(&xprt_info->wakelock, WAKE_LOCK_SUSPEND, xprt->name); wakeup_source_init(&xprt_info->ws, xprt->name); xprt_info->need_len = 0; xprt_info->abort_data_read = 0; INIT_WORK(&xprt_info->read_data, do_read_data); Loading Loading @@ -3274,7 +3272,7 @@ static void msm_ipc_router_remove_xprt(struct msm_ipc_router_xprt *xprt) flush_workqueue(xprt_info->workqueue); destroy_workqueue(xprt_info->workqueue); wake_lock_destroy(&xprt_info->wakelock); wakeup_source_trash(&xprt_info->ws); xprt->priv = 0; kfree(xprt_info); Loading Loading @@ -3369,7 +3367,7 @@ void msm_ipc_router_xprt_notify(struct msm_ipc_router_xprt *xprt, mutex_lock(&xprt_info->rx_lock_lhb2); list_add_tail(&pkt->list, &xprt_info->pkt_list); wake_lock(&xprt_info->wakelock); __pm_stay_awake(&xprt_info->ws); mutex_unlock(&xprt_info->rx_lock_lhb2); queue_work(xprt_info->workqueue, &xprt_info->read_data); } Loading