spi_qsd: Exit gracefully if the system is suspended
When the spi transfer is initiated during/after system suspend the runtime pm framework returns an error. Before propagating the error to the client driver call spi_finalize_current_message to unblock the spi framework waiting for completion signal from spi_qsd driver. Change-Id: Ieee8b93200609143127dbac2f631a60bb028e046 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
This commit is contained in:
parent
64bf9ca9a1
commit
90c3a57b3c
|
@ -1857,6 +1857,7 @@ static int msm_spi_transfer_one_message(struct spi_master *master,
|
|||
if (dd->pdata->is_shared) {
|
||||
if (get_local_resources(dd)) {
|
||||
mutex_unlock(&dd->core_lock);
|
||||
spi_finalize_current_message(master);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -1915,7 +1916,8 @@ static int msm_spi_prepare_transfer_hardware(struct spi_master *master)
|
|||
|
||||
resume_state = pm_runtime_get_sync(dd->dev);
|
||||
if (resume_state < 0)
|
||||
return resume_state;
|
||||
goto spi_finalize;
|
||||
|
||||
/*
|
||||
* Counter-part of system-suspend when runtime-pm is not enabled.
|
||||
* This way, resume can be left empty and device will be put in
|
||||
|
@ -1924,11 +1926,16 @@ static int msm_spi_prepare_transfer_hardware(struct spi_master *master)
|
|||
if (!pm_runtime_enabled(dd->dev))
|
||||
resume_state = msm_spi_pm_resume_runtime(dd->dev);
|
||||
if (resume_state < 0)
|
||||
return resume_state;
|
||||
if (dd->suspended)
|
||||
return -EBUSY;
|
||||
|
||||
goto spi_finalize;
|
||||
if (dd->suspended) {
|
||||
resume_state = -EBUSY;
|
||||
goto spi_finalize;
|
||||
}
|
||||
return 0;
|
||||
|
||||
spi_finalize:
|
||||
spi_finalize_current_message(master);
|
||||
return resume_state;
|
||||
}
|
||||
|
||||
static int msm_spi_unprepare_transfer_hardware(struct spi_master *master)
|
||||
|
|
Loading…
Reference in New Issue