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

Commit 91470038 authored by Mukesh Kumar Savaliya's avatar Mukesh Kumar Savaliya
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 47b13c41
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1827,14 +1827,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;