mhi: core: check MHI PM state under pm_lock

MHI PM state for suspended states needs to be checked under pm_lock,
otherwise MHI host could miss transition state and result in a
data stall.

CRs-Fixed: 2279502
Change-Id: I55cdfb1d5ab5fc745a0e06977c89a18e412c6129
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
This commit is contained in:
Sujeev Dias 2018-07-19 14:51:13 -07:00 committed by Gerrit - the friendly Code Review server
parent 058c23fa7c
commit dc19827181

View File

@ -504,12 +504,6 @@ int mhi_queue_buf(struct mhi_device *mhi_dev,
return -EIO;
}
/* we're in M3 or transitioning to M3 */
if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) {
mhi_cntrl->runtime_get(mhi_cntrl, mhi_cntrl->priv_data);
mhi_cntrl->runtime_put(mhi_cntrl, mhi_cntrl->priv_data);
}
tre_ring = &mhi_chan->tre_ring;
if (mhi_is_ring_full(mhi_cntrl, tre_ring))
return -ENOMEM;
@ -520,6 +514,12 @@ int mhi_queue_buf(struct mhi_device *mhi_dev,
read_lock_irqsave(&mhi_cntrl->pm_lock, flags);
/* we're in M3 or transitioning to M3 */
if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) {
mhi_cntrl->runtime_get(mhi_cntrl, mhi_cntrl->priv_data);
mhi_cntrl->runtime_put(mhi_cntrl, mhi_cntrl->priv_data);
}
/*
* For UL channels always assert WAKE until work is done,
* For DL channels only assert if MHI is in a LPM