Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc198271 authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarSujeev Dias <sdias@codeaurora.org>
parent 058c23fa
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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