Unverified Commit 103c6a31 authored by Mark Brown's avatar Mark Brown
Browse files

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
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -1002,27 +1002,25 @@ static int sprd_spi_probe(struct platform_device *pdev)
	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 (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);