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

Commit 0ef069d0 authored by Bhaumik Bhatt's avatar Bhaumik Bhatt
Browse files

mhi: core: do not acquire channel mutex to notify clients



A deadlock is seen when an MHI client attempts to start channels
for transfer and MHI core driver tries to notify the client of a
a status change. Remove mutex from notify path as it should not
be required since we already use the safe list iteration option.

CRs-Fixed: 2521963
Change-Id: I6388547fb3e0daa1763974a1a8579a3831e3679a
Signed-off-by: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
parent 3eb9c77d
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -1177,10 +1177,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)

	/* notify any clients we enter lpm */
	list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
		mutex_lock(&itr->mutex);
		if (itr->mhi_dev)
			mhi_notify(itr->mhi_dev, MHI_CB_LPM_ENTER);
		mutex_unlock(&itr->mutex);
	}

	return 0;
@@ -1283,10 +1281,8 @@ int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_client)

	/* notify any clients we enter lpm */
	list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
		mutex_lock(&itr->mutex);
		if (itr->mhi_dev)
			mhi_notify(itr->mhi_dev, MHI_CB_LPM_ENTER);
		mutex_unlock(&itr->mutex);
	}

	return 0;
@@ -1322,10 +1318,8 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl)

	/* notify any clients we enter lpm */
	list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
		mutex_lock(&itr->mutex);
		if (itr->mhi_dev)
			mhi_notify(itr->mhi_dev, MHI_CB_LPM_EXIT);
		mutex_unlock(&itr->mutex);
	}

	write_lock_irq(&mhi_cntrl->pm_lock);
@@ -1398,10 +1392,8 @@ int mhi_pm_fast_resume(struct mhi_controller *mhi_cntrl, bool notify_client)
	if (notify_client) {
		list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans,
					 node) {
			mutex_lock(&itr->mutex);
			if (itr->mhi_dev)
				mhi_notify(itr->mhi_dev, MHI_CB_LPM_EXIT);
			mutex_unlock(&itr->mutex);
		}
	}