summaryrefslogtreecommitdiff
path: root/drivers/regulator/pf1550-regulator-rpmsg.c
diff options
context:
space:
mode:
authorRobin Gong <yibin.gong@nxp.com>2017-01-05 14:15:17 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:25:30 +0800
commit73ff734ebdbc5b4e33c60eff2f6870b9ea5713fe (patch)
treeea95535a5e60b511d5202572f5dbe8701466c6e2 /drivers/regulator/pf1550-regulator-rpmsg.c
parentdf2d8c571b379b67d9231965616d09e42fae5e89 (diff)
MLK-13720-4: regulator: pf1550-regulator-rpmsg: fix "rpmsg_send timeout"
Sometimes rpmsg callback triggered quickly before reinit_completion, then cause "rpmsg_send timeout!". Move reinit_completion to the place before rpmsg_send to make sure the completion is ready before callback triggered. Signed-off-by: Robin Gong <yibin.gong@nxp.com> (cherry picked from commit 8e44277d3f27e5f46232bd705ee9ef594db42575)
Diffstat (limited to 'drivers/regulator/pf1550-regulator-rpmsg.c')
-rw-r--r--drivers/regulator/pf1550-regulator-rpmsg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/pf1550-regulator-rpmsg.c b/drivers/regulator/pf1550-regulator-rpmsg.c
index fd0f69dbff56..13f4484aa34a 100644
--- a/drivers/regulator/pf1550-regulator-rpmsg.c
+++ b/drivers/regulator/pf1550-regulator-rpmsg.c
@@ -101,6 +101,9 @@ static int pf1550_send_message(struct pf1550_regulator_rpmsg *msg,
pm_qos_add_request(&info->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 0);
+ /* wait response from rpmsg */
+ reinit_completion(&info->cmd_complete);
+
err = rpmsg_send(info->rpdev->ept, (void *)msg,
sizeof(struct pf1550_regulator_rpmsg));
@@ -110,8 +113,6 @@ static int pf1550_send_message(struct pf1550_regulator_rpmsg *msg,
dev_err(&info->rpdev->dev, "rpmsg_send failed: %d\n", err);
return err;
}
- /* wait response from rpmsg */
- reinit_completion(&info->cmd_complete);
err = wait_for_completion_timeout(&info->cmd_complete,
msecs_to_jiffies(RPMSG_TIMEOUT));
if (!err) {