mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
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).
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user