Commit 40b6a137 authored by Minghao Chi's avatar Minghao Chi Committed by Mark Brown

spi: spi-omap2-mcspi: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. This change is just to simplify the code, no
actual functional changes.
Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarMinghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220414085433.2541670-1-chi.minghao@zte.com.cnSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 32831bf5
...@@ -246,9 +246,8 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) ...@@ -246,9 +246,8 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable)
enable = !enable; enable = !enable;
if (spi->controller_state) { if (spi->controller_state) {
int err = pm_runtime_get_sync(mcspi->dev); int err = pm_runtime_resume_and_get(mcspi->dev);
if (err < 0) { if (err < 0) {
pm_runtime_put_noidle(mcspi->dev);
dev_err(mcspi->dev, "failed to get sync: %d\n", err); dev_err(mcspi->dev, "failed to get sync: %d\n", err);
return; return;
} }
...@@ -1068,9 +1067,8 @@ static int omap2_mcspi_setup(struct spi_device *spi) ...@@ -1068,9 +1067,8 @@ static int omap2_mcspi_setup(struct spi_device *spi)
initial_setup = true; initial_setup = true;
} }
ret = pm_runtime_get_sync(mcspi->dev); ret = pm_runtime_resume_and_get(mcspi->dev);
if (ret < 0) { if (ret < 0) {
pm_runtime_put_noidle(mcspi->dev);
if (initial_setup) if (initial_setup)
omap2_mcspi_cleanup(spi); omap2_mcspi_cleanup(spi);
...@@ -1317,12 +1315,9 @@ static int omap2_mcspi_controller_setup(struct omap2_mcspi *mcspi) ...@@ -1317,12 +1315,9 @@ static int omap2_mcspi_controller_setup(struct omap2_mcspi *mcspi)
struct omap2_mcspi_regs *ctx = &mcspi->ctx; struct omap2_mcspi_regs *ctx = &mcspi->ctx;
int ret = 0; int ret = 0;
ret = pm_runtime_get_sync(mcspi->dev); ret = pm_runtime_resume_and_get(mcspi->dev);
if (ret < 0) { if (ret < 0)
pm_runtime_put_noidle(mcspi->dev);
return ret; return ret;
}
mcspi_write_reg(master, OMAP2_MCSPI_WAKEUPENABLE, mcspi_write_reg(master, OMAP2_MCSPI_WAKEUPENABLE,
OMAP2_MCSPI_WAKEUPENABLE_WKEN); OMAP2_MCSPI_WAKEUPENABLE_WKEN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment