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

Commit 10ae2ac0 authored by Mukesh Kumar Savaliya's avatar Mukesh Kumar Savaliya Committed by Gerrit - the friendly Code Review server
Browse files

spi: spi_qsd: Prevent deadlock while runtime pm is disabled



Do not call runtime suspend forcefully while holding the mutex as runtime
suspend also tries to acquire the same mutex. Instead acquire it properly
with the condition of runtime_pm enablement status without mutex.

Change-Id: I2347820e81ded0821e6f56a415af3bed17a951b4
Signed-off-by: default avatarMukesh Kumar Savaliya <msavaliy@codeaurora.org>
parent 28c1f5d2
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1816,14 +1816,16 @@ static int msm_spi_setup(struct spi_device *spi)
	mb();
	if (dd->pdata->is_shared)
		put_local_resources(dd);
	/* Counter-part of system-resume when runtime-pm is not enabled. */
	if (!pm_runtime_enabled(dd->dev))
		msm_spi_pm_suspend_runtime(dd->dev);

no_resources:
	mutex_unlock(&dd->core_lock);
	/* Counter-part of system-resume when runtime-pm is not enabled. */
	if (!pm_runtime_enabled(dd->dev)) {
		msm_spi_pm_suspend_runtime(dd->dev);
	} else {
		pm_runtime_mark_last_busy(dd->dev);
		pm_runtime_put_autosuspend(dd->dev);
	}

err_setup_exit:
	return rc;