Unverified Commit 2289fa07 authored by Mark Brown's avatar Mark Brown
Browse files

spi: Convert to platform remove callback returning

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

This patch series adapts the platform drivers below drivers/spi
to use the .remove_new() callback. Compared to the traditional .remove()
callback .remove_new() returns no value. This is a good thing because
the driver core doesn't (and cannot) cope for errors during remove. The
only effect of a non-zero return value in .remove() is that the driver
core emits a warning. The device is removed anyhow and an early return
from .remove() usually yields a resource leak.

By changing the remove callback to return void driver authors cannot
reasonably assume any more that there is some kind of cleanup later.

All drivers touched here returned zero unconditionally in their remove
callback, so they could all be converted trivially to .remove_new().
parents 20064c47 3ffefa1d
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ static int ar934x_spi_probe(struct platform_device *pdev)
	return ret;
}

static int ar934x_spi_remove(struct platform_device *pdev)
static void ar934x_spi_remove(struct platform_device *pdev)
{
	struct spi_controller *ctlr;
	struct ar934x_spi *sp;
@@ -230,8 +230,6 @@ static int ar934x_spi_remove(struct platform_device *pdev)

	spi_unregister_controller(ctlr);
	clk_disable_unprepare(sp->clk);

	return 0;
}

static struct platform_driver ar934x_spi_driver = {
@@ -240,7 +238,7 @@ static struct platform_driver ar934x_spi_driver = {
		.of_match_table = ar934x_spi_match,
	},
	.probe = ar934x_spi_probe,
	.remove = ar934x_spi_remove,
	.remove_new = ar934x_spi_remove,
};

module_platform_driver(ar934x_spi_driver);
+2 −4
Original line number Diff line number Diff line
@@ -908,14 +908,12 @@ static int a3700_spi_probe(struct platform_device *pdev)
	return ret;
}

static int a3700_spi_remove(struct platform_device *pdev)
static void a3700_spi_remove(struct platform_device *pdev)
{
	struct spi_controller *host = platform_get_drvdata(pdev);
	struct a3700_spi *spi = spi_controller_get_devdata(host);

	clk_unprepare(spi->clk);

	return 0;
}

static struct platform_driver a3700_spi_driver = {
@@ -924,7 +922,7 @@ static struct platform_driver a3700_spi_driver = {
		.of_match_table = of_match_ptr(a3700_spi_dt_ids),
	},
	.probe		= a3700_spi_probe,
	.remove		= a3700_spi_remove,
	.remove_new	= a3700_spi_remove,
};

module_platform_driver(a3700_spi_driver);
+2 −3
Original line number Diff line number Diff line
@@ -787,13 +787,12 @@ static int aspeed_spi_probe(struct platform_device *pdev)
	return ret;
}

static int aspeed_spi_remove(struct platform_device *pdev)
static void aspeed_spi_remove(struct platform_device *pdev)
{
	struct aspeed_spi *aspi = platform_get_drvdata(pdev);

	aspeed_spi_enable(aspi, false);
	clk_disable_unprepare(aspi->clk);
	return 0;
}

/*
@@ -1201,7 +1200,7 @@ MODULE_DEVICE_TABLE(of, aspeed_spi_matches);

static struct platform_driver aspeed_spi_driver = {
	.probe			= aspeed_spi_probe,
	.remove			= aspeed_spi_remove,
	.remove_new		= aspeed_spi_remove,
	.driver	= {
		.name		= DEVICE_NAME,
		.of_match_table = aspeed_spi_matches,
+2 −4
Original line number Diff line number Diff line
@@ -647,15 +647,13 @@ __maybe_unused static int at91_usart_spi_resume(struct device *dev)
	return spi_controller_resume(ctrl);
}

static int at91_usart_spi_remove(struct platform_device *pdev)
static void at91_usart_spi_remove(struct platform_device *pdev)
{
	struct spi_controller *ctlr = platform_get_drvdata(pdev);
	struct at91_usart_spi *aus = spi_controller_get_devdata(ctlr);

	at91_usart_spi_release_dma(ctlr);
	clk_disable_unprepare(aus->clk);

	return 0;
}

static const struct dev_pm_ops at91_usart_spi_pm_ops = {
@@ -670,7 +668,7 @@ static struct platform_driver at91_usart_spi_driver = {
		.pm = &at91_usart_spi_pm_ops,
	},
	.probe = at91_usart_spi_probe,
	.remove = at91_usart_spi_remove,
	.remove_new = at91_usart_spi_remove,
};

module_platform_driver(at91_usart_spi_driver);
+2 −4
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ static int ath79_spi_probe(struct platform_device *pdev)
	return ret;
}

static int ath79_spi_remove(struct platform_device *pdev)
static void ath79_spi_remove(struct platform_device *pdev)
{
	struct ath79_spi *sp = platform_get_drvdata(pdev);

@@ -245,8 +245,6 @@ static int ath79_spi_remove(struct platform_device *pdev)
	ath79_spi_disable(sp);
	clk_disable_unprepare(sp->clk);
	spi_controller_put(sp->bitbang.master);

	return 0;
}

static void ath79_spi_shutdown(struct platform_device *pdev)
@@ -262,7 +260,7 @@ MODULE_DEVICE_TABLE(of, ath79_spi_of_match);

static struct platform_driver ath79_spi_driver = {
	.probe		= ath79_spi_probe,
	.remove		= ath79_spi_remove,
	.remove_new	= ath79_spi_remove,
	.shutdown	= ath79_spi_shutdown,
	.driver		= {
		.name	= DRV_NAME,
Loading