summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-sprd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-sprd.c')
-rw-r--r--drivers/spi/spi-sprd.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c
index 65b8075da4eb..518c7eaca84e 100644
--- a/drivers/spi/spi-sprd.c
+++ b/drivers/spi/spi-sprd.c
@@ -929,8 +929,7 @@ static int sprd_spi_probe(struct platform_device *pdev)
return -ENOMEM;
ss = spi_controller_get_devdata(sctlr);
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- ss->base = devm_ioremap_resource(&pdev->dev, res);
+ ss->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(ss->base)) {
ret = PTR_ERR(ss->base);
goto free_controller;
@@ -1002,27 +1001,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 +1073,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);