Commit e190a0c3 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Wolfram Sang
Browse files

i2c: Convert to platform remove callback returning void



The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarAlain Volmat <alain.volmat@foss.st.com>
Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Acked-by: default avatarBaruch Siach <baruch@tkos.co.il>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
Acked-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Acked-by: default avatarJochen Friedrich <jochen@scram.de>
Acked-by: default avatarPeter Rosin <peda@axentia.se>
Acked-by: default avatarVadim Pasternak <vadimp@nvidia.com>
Reviewed-by: default avatarAsmaa Mnebhi <asnaa@nvidia.com>
Reviewed-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: default avatarChris Pringle <chris.pringle@phabrix.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: default avatarPatrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: default avatarTali Perry <tali.perry@nuvoton.com>
Reviewed-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 9561de3a
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -465,14 +465,12 @@ static int altr_i2c_probe(struct platform_device *pdev)
	return 0;
}

static int altr_i2c_remove(struct platform_device *pdev)
static void altr_i2c_remove(struct platform_device *pdev)
{
	struct altr_i2c_dev *idev = platform_get_drvdata(pdev);

	clk_disable_unprepare(idev->i2c_clk);
	i2c_del_adapter(&idev->adapter);

	return 0;
}

/* Match table for of_platform binding */
@@ -484,7 +482,7 @@ MODULE_DEVICE_TABLE(of, altr_i2c_of_match);

static struct platform_driver altr_i2c_driver = {
	.probe = altr_i2c_probe,
	.remove = altr_i2c_remove,
	.remove_new = altr_i2c_remove,
	.driver = {
		.name = "altera-i2c",
		.of_match_table = altr_i2c_of_match,
+2 −3
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@ static int i2c_amd_probe(struct platform_device *pdev)
	return ret;
}

static int i2c_amd_remove(struct platform_device *pdev)
static void i2c_amd_remove(struct platform_device *pdev)
{
	struct amd_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
	struct amd_i2c_common *i2c_common = &i2c_dev->common;
@@ -336,7 +336,6 @@ static int i2c_amd_remove(struct platform_device *pdev)
	i2c_unlock_bus(&i2c_dev->adap, I2C_LOCK_ROOT_ADAPTER);

	i2c_del_adapter(&i2c_dev->adap);
	return 0;
}

static const struct acpi_device_id i2c_amd_acpi_match[] = {
@@ -347,7 +346,7 @@ MODULE_DEVICE_TABLE(acpi, i2c_amd_acpi_match);

static struct platform_driver i2c_amd_plat_driver = {
	.probe = i2c_amd_probe,
	.remove = i2c_amd_remove,
	.remove_new = i2c_amd_remove,
	.driver = {
		.name = "i2c_amd_mp2",
		.acpi_match_table = ACPI_PTR(i2c_amd_acpi_match),
+2 −4
Original line number Diff line number Diff line
@@ -1061,7 +1061,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
	return 0;
}

static int aspeed_i2c_remove_bus(struct platform_device *pdev)
static void aspeed_i2c_remove_bus(struct platform_device *pdev)
{
	struct aspeed_i2c_bus *bus = platform_get_drvdata(pdev);
	unsigned long flags;
@@ -1077,13 +1077,11 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev)
	reset_control_assert(bus->rst);

	i2c_del_adapter(&bus->adap);

	return 0;
}

static struct platform_driver aspeed_i2c_bus_driver = {
	.probe		= aspeed_i2c_probe_bus,
	.remove		= aspeed_i2c_remove_bus,
	.remove_new	= aspeed_i2c_remove_bus,
	.driver		= {
		.name		= "aspeed-i2c-bus",
		.of_match_table	= aspeed_i2c_bus_of_table,
+2 −4
Original line number Diff line number Diff line
@@ -273,7 +273,7 @@ static int at91_twi_probe(struct platform_device *pdev)
	return 0;
}

static int at91_twi_remove(struct platform_device *pdev)
static void at91_twi_remove(struct platform_device *pdev)
{
	struct at91_twi_dev *dev = platform_get_drvdata(pdev);

@@ -282,8 +282,6 @@ static int at91_twi_remove(struct platform_device *pdev)

	pm_runtime_disable(dev->dev);
	pm_runtime_set_suspended(dev->dev);

	return 0;
}

static int __maybe_unused at91_twi_runtime_suspend(struct device *dev)
@@ -342,7 +340,7 @@ static const struct dev_pm_ops __maybe_unused at91_twi_pm = {

static struct platform_driver at91_twi_driver = {
	.probe		= at91_twi_probe,
	.remove		= at91_twi_remove,
	.remove_new	= at91_twi_remove,
	.id_table	= at91_twi_devtypes,
	.driver		= {
		.name	= "at91_i2c",
+2 −3
Original line number Diff line number Diff line
@@ -334,13 +334,12 @@ i2c_au1550_probe(struct platform_device *pdev)
	return 0;
}

static int i2c_au1550_remove(struct platform_device *pdev)
static void i2c_au1550_remove(struct platform_device *pdev)
{
	struct i2c_au1550_data *priv = platform_get_drvdata(pdev);

	i2c_del_adapter(&priv->adap);
	i2c_au1550_disable(priv);
	return 0;
}

#ifdef CONFIG_PM
@@ -379,7 +378,7 @@ static struct platform_driver au1xpsc_smbus_driver = {
		.pm	= AU1XPSC_SMBUS_PMOPS,
	},
	.probe		= i2c_au1550_probe,
	.remove		= i2c_au1550_remove,
	.remove_new	= i2c_au1550_remove,
};

module_platform_driver(au1xpsc_smbus_driver);
Loading