summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsiu-Chang Chen <hsiuchangchen@google.com>2023-03-16 13:47:39 +0530
committerHsiu-Chang Chen <hsiuchangchen@google.com>2023-03-17 09:30:02 +0800
commitc2a3190fca116ef1a37e16652966723a46e06694 (patch)
tree83d18df1249868121ace6af193b1f941f71aa9d9
parentdf75d4caffd0de5039939b8b4b524cdfe20e5292 (diff)
downloadcnss2-c2a3190fca116ef1a37e16652966723a46e06694.tar.gz
There is an possible case where host can detects RDDM while performing mhi_pm_resume() and in parallel there is RDDM event from device where we provide status callback for RDDM. If device is in RDDM state we will give status callback twice, avoid status_cb twice by adding check if mhi_cntrl->ee is already in RDDM state. Bug: 272088770 Test: Regression Test Change-Id: I85aa8e9f85b5fceceda271df20a733b1e95ca2ea Signed-off-by: Hsiu-Chang Chen <hsiuchangchen@google.com>
-rw-r--r--mhi/core/pm.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/mhi/core/pm.c b/mhi/core/pm.c
index 02b340f..fd34e6c 100644
--- a/mhi/core/pm.c
+++ b/mhi/core/pm.c
@@ -806,17 +806,23 @@ void mhi_pm_st_worker(struct work_struct *work)
static bool mhi_in_rddm(struct mhi_controller *mhi_cntrl)
{
struct device *dev = &mhi_cntrl->mhi_dev->dev;
+ enum mhi_ee_type ee = MHI_EE_MAX;
- if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM
+ ee = mhi_get_exec_env(mhi_cntrl);
+
+ if (mhi_cntrl->rddm_image && ee == MHI_EE_RDDM
&& mhi_is_active(mhi_cntrl)) {
- mhi_cntrl->ee = MHI_EE_RDDM;
MHI_ERR("RDDM event occurred!\n");
/* notify critical clients with early notifications */
mhi_report_error(mhi_cntrl);
- mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM);
+ /* Notify mhi controller only once for RDDM event*/
+ if (ee == MHI_EE_RDDM && mhi_cntrl->ee != MHI_EE_RDDM) {
+ mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM);
+ mhi_cntrl->ee = MHI_EE_RDDM;
+ }
wake_up_all(&mhi_cntrl->state_event);
return true;