spi: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220418110226.2559081-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Minghao Chi 2022-04-18 11:02:26 +00:00 committed by Mark Brown
parent 79422ed9bd
commit dd769f1548
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 2 additions and 4 deletions

View File

@ -1611,9 +1611,8 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
mutex_lock(&ctlr->io_mutex); mutex_lock(&ctlr->io_mutex);
if (!was_busy && ctlr->auto_runtime_pm) { if (!was_busy && ctlr->auto_runtime_pm) {
ret = pm_runtime_get_sync(ctlr->dev.parent); ret = pm_runtime_resume_and_get(ctlr->dev.parent);
if (ret < 0) { if (ret < 0) {
pm_runtime_put_noidle(ctlr->dev.parent);
dev_err(&ctlr->dev, "Failed to power device: %d\n", dev_err(&ctlr->dev, "Failed to power device: %d\n",
ret); ret);
mutex_unlock(&ctlr->io_mutex); mutex_unlock(&ctlr->io_mutex);
@ -3548,10 +3547,9 @@ int spi_setup(struct spi_device *spi)
} }
if (spi->controller->auto_runtime_pm && spi->controller->set_cs) { if (spi->controller->auto_runtime_pm && spi->controller->set_cs) {
status = pm_runtime_get_sync(spi->controller->dev.parent); status = pm_runtime_resume_and_get(spi->controller->dev.parent);
if (status < 0) { if (status < 0) {
mutex_unlock(&spi->controller->io_mutex); mutex_unlock(&spi->controller->io_mutex);
pm_runtime_put_noidle(spi->controller->dev.parent);
dev_err(&spi->controller->dev, "Failed to power device: %d\n", dev_err(&spi->controller->dev, "Failed to power device: %d\n",
status); status);
return status; return status;