Commit 103c6a31 authored by Mark Brown's avatar Mark Brown

spi: sprd: Convert to platform remove callback

Merge series from Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:

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).
parents 0df9f6cf 3b74dc8a
...@@ -1002,27 +1002,25 @@ static int sprd_spi_probe(struct platform_device *pdev) ...@@ -1002,27 +1002,25 @@ static int sprd_spi_probe(struct platform_device *pdev)
return ret; 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 spi_controller *sctlr = platform_get_drvdata(pdev);
struct sprd_spi *ss = spi_controller_get_devdata(sctlr); struct sprd_spi *ss = spi_controller_get_devdata(sctlr);
int ret; int ret;
ret = pm_runtime_resume_and_get(ss->dev); ret = pm_runtime_get_sync(ss->dev);
if (ret < 0) { if (ret < 0)
dev_err(ss->dev, "failed to resume SPI controller\n"); dev_err(ss->dev, "failed to resume SPI controller\n");
return ret;
}
spi_controller_suspend(sctlr); spi_controller_suspend(sctlr);
if (ss->dma.enable) if (ret >= 0) {
sprd_spi_dma_release(ss); if (ss->dma.enable)
clk_disable_unprepare(ss->clk); sprd_spi_dma_release(ss);
clk_disable_unprepare(ss->clk);
}
pm_runtime_put_noidle(&pdev->dev); pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return 0;
} }
static int __maybe_unused sprd_spi_runtime_suspend(struct device *dev) static int __maybe_unused sprd_spi_runtime_suspend(struct device *dev)
...@@ -1076,7 +1074,7 @@ static struct platform_driver sprd_spi_driver = { ...@@ -1076,7 +1074,7 @@ static struct platform_driver sprd_spi_driver = {
.pm = &sprd_spi_pm_ops, .pm = &sprd_spi_pm_ops,
}, },
.probe = sprd_spi_probe, .probe = sprd_spi_probe,
.remove = sprd_spi_remove, .remove_new = sprd_spi_remove,
}; };
module_platform_driver(sprd_spi_driver); module_platform_driver(sprd_spi_driver);
......
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