i2c: Make remove callback return void

The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
Uwe Kleine-König
2022-08-15 10:02:30 +02:00
committed by Wolfram Sang
parent 6a8f359c31
commit ed5c2f5fd1
619 changed files with 646 additions and 1733 deletions

View File

@@ -156,7 +156,7 @@ those devices, and a remove() method to unbind.
::
static int foo_probe(struct i2c_client *client);
static int foo_remove(struct i2c_client *client);
static void foo_remove(struct i2c_client *client);
Remember that the i2c_driver does not create those client handles. The
handle may be used during foo_probe(). If foo_probe() reports success

View File

@@ -178,7 +178,7 @@ err:
return ret;
}
static int mcu_remove(struct i2c_client *client)
static void mcu_remove(struct i2c_client *client)
{
struct mcu *mcu = i2c_get_clientdata(client);
@@ -193,7 +193,6 @@ static int mcu_remove(struct i2c_client *client)
mcu_gpiochip_remove(mcu);
kfree(mcu);
return 0;
}
static const struct i2c_device_id mcu_ids[] = {

View File

@@ -775,7 +775,7 @@ static int ht16k33_probe(struct i2c_client *client)
return err;
}
static int ht16k33_remove(struct i2c_client *client)
static void ht16k33_remove(struct i2c_client *client)
{
struct ht16k33_priv *priv = i2c_get_clientdata(client);
struct ht16k33_fbdev *fbdev = &priv->fbdev;
@@ -796,8 +796,6 @@ static int ht16k33_remove(struct i2c_client *client)
device_remove_file(&client->dev, &dev_attr_map_seg14);
break;
}
return 0;
}
static const struct i2c_device_id ht16k33_i2c_match[] = {

View File

@@ -340,13 +340,12 @@ fail1:
return err;
}
static int lcd2s_i2c_remove(struct i2c_client *i2c)
static void lcd2s_i2c_remove(struct i2c_client *i2c)
{
struct lcd2s_data *lcd2s = i2c_get_clientdata(i2c);
charlcd_unregister(lcd2s->charlcd);
charlcd_free(lcd2s->charlcd);
return 0;
}
static const struct i2c_device_id lcd2s_i2c_id[] = {

View File

@@ -341,14 +341,12 @@ static int ipmb_probe(struct i2c_client *client)
return 0;
}
static int ipmb_remove(struct i2c_client *client)
static void ipmb_remove(struct i2c_client *client)
{
struct ipmb_dev *ipmb_dev = i2c_get_clientdata(client);
i2c_slave_unregister(client);
misc_deregister(&ipmb_dev->miscdev);
return 0;
}
static const struct i2c_device_id ipmb_id[] = {

View File

@@ -424,7 +424,7 @@ static void ipmi_ipmb_request_events(void *send_info)
/* We don't fetch events here. */
}
static int ipmi_ipmb_remove(struct i2c_client *client)
static void ipmi_ipmb_remove(struct i2c_client *client)
{
struct ipmi_ipmb_dev *iidev = i2c_get_clientdata(client);
@@ -438,8 +438,6 @@ static int ipmi_ipmb_remove(struct i2c_client *client)
ipmi_ipmb_stop_thread(iidev);
ipmi_unregister_smi(iidev->intf);
return 0;
}
static int ipmi_ipmb_probe(struct i2c_client *client)

View File

@@ -1281,13 +1281,13 @@ static void shutdown_ssif(void *send_info)
}
}
static int ssif_remove(struct i2c_client *client)
static void ssif_remove(struct i2c_client *client)
{
struct ssif_info *ssif_info = i2c_get_clientdata(client);
struct ssif_addr_info *addr_info;
if (!ssif_info)
return 0;
return;
/*
* After this point, we won't deliver anything asychronously
@@ -1303,8 +1303,6 @@ static int ssif_remove(struct i2c_client *client)
}
kfree(ssif_info);
return 0;
}
static int read_response(struct i2c_client *client, unsigned char *resp)

View File

@@ -264,13 +264,11 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
* @param: client, the i2c_client description (TPM I2C description).
* @return: 0 in case of success.
*/
static int st33zp24_i2c_remove(struct i2c_client *client)
static void st33zp24_i2c_remove(struct i2c_client *client)
{
struct tpm_chip *chip = i2c_get_clientdata(client);
st33zp24_remove(chip);
return 0;
}
static const struct i2c_device_id st33zp24_i2c_id[] = {

View File

@@ -179,12 +179,11 @@ static int i2c_atmel_probe(struct i2c_client *client,
return tpm_chip_register(chip);
}
static int i2c_atmel_remove(struct i2c_client *client)
static void i2c_atmel_remove(struct i2c_client *client)
{
struct device *dev = &(client->dev);
struct tpm_chip *chip = dev_get_drvdata(dev);
tpm_chip_unregister(chip);
return 0;
}
static const struct i2c_device_id i2c_atmel_id[] = {

View File

@@ -706,15 +706,13 @@ static int tpm_tis_i2c_probe(struct i2c_client *client,
return rc;
}
static int tpm_tis_i2c_remove(struct i2c_client *client)
static void tpm_tis_i2c_remove(struct i2c_client *client)
{
struct tpm_chip *chip = tpm_dev.chip;
tpm_chip_unregister(chip);
release_locality(chip, tpm_dev.locality, 1);
tpm_dev.client = NULL;
return 0;
}
static struct i2c_driver tpm_tis_i2c_driver = {

View File

@@ -622,12 +622,11 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
return tpm_chip_register(chip);
}
static int i2c_nuvoton_remove(struct i2c_client *client)
static void i2c_nuvoton_remove(struct i2c_client *client)
{
struct tpm_chip *chip = i2c_get_clientdata(client);
tpm_chip_unregister(chip);
return 0;
}
static const struct i2c_device_id i2c_nuvoton_id[] = {

View File

@@ -351,13 +351,12 @@ static int tpm_tis_i2c_probe(struct i2c_client *dev,
NULL);
}
static int tpm_tis_i2c_remove(struct i2c_client *client)
static void tpm_tis_i2c_remove(struct i2c_client *client)
{
struct tpm_chip *chip = i2c_get_clientdata(client);
tpm_chip_unregister(chip);
tpm_tis_remove(chip);
return 0;
}
static const struct i2c_device_id tpm_tis_i2c_id[] = {

View File

@@ -763,20 +763,18 @@ static int tpm_cr50_i2c_probe(struct i2c_client *client)
* - 0: Success.
* - -errno: A POSIX error code.
*/
static int tpm_cr50_i2c_remove(struct i2c_client *client)
static void tpm_cr50_i2c_remove(struct i2c_client *client)
{
struct tpm_chip *chip = i2c_get_clientdata(client);
struct device *dev = &client->dev;
if (!chip) {
dev_crit(dev, "Could not get client data at remove, memory corruption ahead\n");
return 0;
return;
}
tpm_chip_unregister(chip);
tpm_cr50_release_locality(chip, true);
return 0;
}
static SIMPLE_DEV_PM_OPS(cr50_i2c_pm, tpm_pm_suspend, tpm_pm_resume);

View File

@@ -665,10 +665,9 @@ static int cdce706_probe(struct i2c_client *client)
cdce);
}
static int cdce706_remove(struct i2c_client *client)
static void cdce706_remove(struct i2c_client *client)
{
of_clk_del_provider(client->dev.of_node);
return 0;
}

View File

@@ -557,7 +557,7 @@ static int cs2000_version_print(struct cs2000_priv *priv)
return 0;
}
static int cs2000_remove(struct i2c_client *client)
static void cs2000_remove(struct i2c_client *client)
{
struct cs2000_priv *priv = i2c_get_clientdata(client);
struct device *dev = priv_to_dev(priv);
@@ -566,8 +566,6 @@ static int cs2000_remove(struct i2c_client *client)
of_clk_del_provider(np);
clk_hw_unregister(&priv->hw);
return 0;
}
static int cs2000_probe(struct i2c_client *client)

View File

@@ -370,10 +370,9 @@ static int si514_probe(struct i2c_client *client)
return 0;
}
static int si514_remove(struct i2c_client *client)
static void si514_remove(struct i2c_client *client)
{
of_clk_del_provider(client->dev.of_node);
return 0;
}
static const struct i2c_device_id si514_id[] = {

View File

@@ -1796,7 +1796,7 @@ cleanup:
return err;
}
static int si5341_remove(struct i2c_client *client)
static void si5341_remove(struct i2c_client *client)
{
struct clk_si5341 *data = i2c_get_clientdata(client);
int i;
@@ -1807,8 +1807,6 @@ static int si5341_remove(struct i2c_client *client)
if (data->clk[i].vddo_reg)
regulator_disable(data->clk[i].vddo_reg);
}
return 0;
}
static const struct i2c_device_id si5341_id[] = {

View File

@@ -1651,11 +1651,9 @@ static int si5351_i2c_probe(struct i2c_client *client)
return 0;
}
static int si5351_i2c_remove(struct i2c_client *client)
static void si5351_i2c_remove(struct i2c_client *client)
{
of_clk_del_provider(client->dev.of_node);
return 0;
}
static struct i2c_driver si5351_driver = {

View File

@@ -498,10 +498,9 @@ static int si570_probe(struct i2c_client *client)
return 0;
}
static int si570_remove(struct i2c_client *client)
static void si570_remove(struct i2c_client *client)
{
of_clk_del_provider(client->dev.of_node);
return 0;
}
static const struct of_device_id clk_si570_of_match[] = {

View File

@@ -1138,7 +1138,7 @@ err_clk:
return ret;
}
static int vc5_remove(struct i2c_client *client)
static void vc5_remove(struct i2c_client *client)
{
struct vc5_driver_data *vc5 = i2c_get_clientdata(client);
@@ -1146,8 +1146,6 @@ static int vc5_remove(struct i2c_client *client)
if (vc5->chip_info->flags & VC5_HAS_INTERNAL_XTAL)
clk_unregister_fixed_rate(vc5->pin_xin);
return 0;
}
static int __maybe_unused vc5_suspend(struct device *dev)

Some files were not shown because too many files have changed in this diff Show More