diff options
author | Mark Brown <[email protected]> | 2023-03-20 18:50:05 +0000 |
---|---|---|
committer | Mark Brown <[email protected]> | 2023-03-20 18:50:05 +0000 |
commit | 103c6a315bc7ae0442be683b8d725d51615d280b (patch) | |
tree | daf3206c839ef0f45b7f8e501336922d72bb9942 | |
parent | 0df9f6cf9576558fb1aba8527a66775e96e2bd2b (diff) | |
parent | 3b74dc8acd5c2e59d4a1988a87d64b08fba56d5f (diff) |
spi: sprd: Convert to platform remove callback
Merge series from Uwe Kleine-König <[email protected]>:
An early error return from a remove callback is usally wrong. In the
case of the spi-sprd driver it's not that critical because the skipped
steps are mainly undoing the things that a successful runtime-resume
would have done.
Still it's cleaner to not exit early and not return an (mostly ignored)
error value. The second patch converts to .remove_new (which is the
motivation for this series).
-rw-r--r-- | drivers/spi/spi-sprd.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c index 65b8075da4eb..702acaeebab2 100644 --- a/drivers/spi/spi-sprd.c +++ b/drivers/spi/spi-sprd.c @@ -1002,27 +1002,25 @@ free_controller: return ret; } -static int sprd_spi_remove(struct platform_device *pdev) +static void sprd_spi_remove(struct platform_device *pdev) { struct spi_controller *sctlr = platform_get_drvdata(pdev); struct sprd_spi *ss = spi_controller_get_devdata(sctlr); int ret; - ret = pm_runtime_resume_and_get(ss->dev); - if (ret < 0) { + ret = pm_runtime_get_sync(ss->dev); + if (ret < 0) dev_err(ss->dev, "failed to resume SPI controller\n"); - return ret; - } spi_controller_suspend(sctlr); - if (ss->dma.enable) - sprd_spi_dma_release(ss); - clk_disable_unprepare(ss->clk); + if (ret >= 0) { + if (ss->dma.enable) + sprd_spi_dma_release(ss); + clk_disable_unprepare(ss->clk); + } pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); - - return 0; } static int __maybe_unused sprd_spi_runtime_suspend(struct device *dev) @@ -1076,7 +1074,7 @@ static struct platform_driver sprd_spi_driver = { .pm = &sprd_spi_pm_ops, }, .probe = sprd_spi_probe, - .remove = sprd_spi_remove, + .remove_new = sprd_spi_remove, }; module_platform_driver(sprd_spi_driver); |