Skip to content

Commit 103c6a3

Browse files
committed
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).
2 parents 0df9f6c + 3b74dc8 commit 103c6a3

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

drivers/spi/spi-sprd.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,27 +1002,25 @@ static int sprd_spi_probe(struct platform_device *pdev)
10021002
return ret;
10031003
}
10041004

1005-
static int sprd_spi_remove(struct platform_device *pdev)
1005+
static void sprd_spi_remove(struct platform_device *pdev)
10061006
{
10071007
struct spi_controller *sctlr = platform_get_drvdata(pdev);
10081008
struct sprd_spi *ss = spi_controller_get_devdata(sctlr);
10091009
int ret;
10101010

1011-
ret = pm_runtime_resume_and_get(ss->dev);
1012-
if (ret < 0) {
1011+
ret = pm_runtime_get_sync(ss->dev);
1012+
if (ret < 0)
10131013
dev_err(ss->dev, "failed to resume SPI controller\n");
1014-
return ret;
1015-
}
10161014

10171015
spi_controller_suspend(sctlr);
10181016

1019-
if (ss->dma.enable)
1020-
sprd_spi_dma_release(ss);
1021-
clk_disable_unprepare(ss->clk);
1017+
if (ret >= 0) {
1018+
if (ss->dma.enable)
1019+
sprd_spi_dma_release(ss);
1020+
clk_disable_unprepare(ss->clk);
1021+
}
10221022
pm_runtime_put_noidle(&pdev->dev);
10231023
pm_runtime_disable(&pdev->dev);
1024-
1025-
return 0;
10261024
}
10271025

10281026
static int __maybe_unused sprd_spi_runtime_suspend(struct device *dev)
@@ -1076,7 +1074,7 @@ static struct platform_driver sprd_spi_driver = {
10761074
.pm = &sprd_spi_pm_ops,
10771075
},
10781076
.probe = sprd_spi_probe,
1079-
.remove = sprd_spi_remove,
1077+
.remove_new = sprd_spi_remove,
10801078
};
10811079

10821080
module_platform_driver(sprd_spi_driver);

0 commit comments

Comments
 (0)