Loading drivers/soc/qcom/rpm-smd.c +33 −8 Original line number Diff line number Diff line Loading @@ -747,6 +747,7 @@ static int msm_rpm_read_sleep_ack(void) { int ret; char buf[MAX_ERR_BUFFER_SIZE] = {0}; uint32_t msg_id; if (glink_enabled) ret = msm_rpm_glink_rx_poll(glink_data->glink_handle); Loading @@ -773,24 +774,42 @@ static int msm_rpm_read_sleep_ack(void) * spinlock from being locked out. */ if (!timeout) { pr_err("Timed out waiting for RPM ACK\n"); if (!timeout) return -EAGAIN; } ret = msm_rpm_read_smd_data(buf); if (!ret) if (!ret) { /* Mimic Glink behavior to ensure that the * data is read and the msg is removed from * the wait list. We should have gotten here * only when there are no drivers waiting on * ACKs. msm_rpm_get_entry_from_msg_id() * return non-NULL only then. */ msg_id = msm_rpm_get_msg_id_from_ack(buf); msm_rpm_process_ack(msg_id, 0); ret = smd_is_pkt_avail(msm_rpm_data.ch_info); } } return ret; } static void msm_rpm_flush_noack_messages(void) { while (!list_empty(&msm_rpm_wait_list)) { if (!msm_rpm_read_sleep_ack()) break; } } static int msm_rpm_flush_requests(bool print) { struct rb_node *t; int ret; int count = 0; msm_rpm_flush_noack_messages(); for (t = rb_first(&tr_root); t; t = rb_next(t)) { struct slp_buf *s = rb_entry(t, struct slp_buf, node); Loading Loading @@ -827,10 +846,12 @@ static int msm_rpm_flush_requests(bool print) if (ret >= 0) count--; else else { pr_err("Timed out waiting for RPM ACK\n"); return ret; } } } return 0; } Loading Loading @@ -1057,14 +1078,18 @@ static void msm_rpm_notify(void *data, unsigned int event) bool msm_rpm_waiting_for_ack(void) { bool ret; bool ret = false; unsigned long flags; struct msm_rpm_wait_data *elem = NULL; spin_lock_irqsave(&msm_rpm_list_lock, flags); ret = list_empty(&msm_rpm_wait_list); elem = list_first_entry_or_null(&msm_rpm_wait_list, struct msm_rpm_wait_data, list); if (elem) ret = !elem->delete_on_ack; spin_unlock_irqrestore(&msm_rpm_list_lock, flags); return !ret; return ret; } static struct msm_rpm_wait_data *msm_rpm_get_entry_from_msg_id(uint32_t msg_id) Loading Loading
drivers/soc/qcom/rpm-smd.c +33 −8 Original line number Diff line number Diff line Loading @@ -747,6 +747,7 @@ static int msm_rpm_read_sleep_ack(void) { int ret; char buf[MAX_ERR_BUFFER_SIZE] = {0}; uint32_t msg_id; if (glink_enabled) ret = msm_rpm_glink_rx_poll(glink_data->glink_handle); Loading @@ -773,24 +774,42 @@ static int msm_rpm_read_sleep_ack(void) * spinlock from being locked out. */ if (!timeout) { pr_err("Timed out waiting for RPM ACK\n"); if (!timeout) return -EAGAIN; } ret = msm_rpm_read_smd_data(buf); if (!ret) if (!ret) { /* Mimic Glink behavior to ensure that the * data is read and the msg is removed from * the wait list. We should have gotten here * only when there are no drivers waiting on * ACKs. msm_rpm_get_entry_from_msg_id() * return non-NULL only then. */ msg_id = msm_rpm_get_msg_id_from_ack(buf); msm_rpm_process_ack(msg_id, 0); ret = smd_is_pkt_avail(msm_rpm_data.ch_info); } } return ret; } static void msm_rpm_flush_noack_messages(void) { while (!list_empty(&msm_rpm_wait_list)) { if (!msm_rpm_read_sleep_ack()) break; } } static int msm_rpm_flush_requests(bool print) { struct rb_node *t; int ret; int count = 0; msm_rpm_flush_noack_messages(); for (t = rb_first(&tr_root); t; t = rb_next(t)) { struct slp_buf *s = rb_entry(t, struct slp_buf, node); Loading Loading @@ -827,10 +846,12 @@ static int msm_rpm_flush_requests(bool print) if (ret >= 0) count--; else else { pr_err("Timed out waiting for RPM ACK\n"); return ret; } } } return 0; } Loading Loading @@ -1057,14 +1078,18 @@ static void msm_rpm_notify(void *data, unsigned int event) bool msm_rpm_waiting_for_ack(void) { bool ret; bool ret = false; unsigned long flags; struct msm_rpm_wait_data *elem = NULL; spin_lock_irqsave(&msm_rpm_list_lock, flags); ret = list_empty(&msm_rpm_wait_list); elem = list_first_entry_or_null(&msm_rpm_wait_list, struct msm_rpm_wait_data, list); if (elem) ret = !elem->delete_on_ack; spin_unlock_irqrestore(&msm_rpm_list_lock, flags); return !ret; return ret; } static struct msm_rpm_wait_data *msm_rpm_get_entry_from_msg_id(uint32_t msg_id) Loading