Skip to content

Commit ed5c2f5

Browse files
Uwe Kleine-Königwsakernel
authored andcommitted
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>
1 parent 6a8f359 commit ed5c2f5

File tree

619 files changed

+646
-1733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

619 files changed

+646
-1733
lines changed

Documentation/i2c/writing-clients.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ those devices, and a remove() method to unbind.
156156
::
157157

158158
static int foo_probe(struct i2c_client *client);
159-
static int foo_remove(struct i2c_client *client);
159+
static void foo_remove(struct i2c_client *client);
160160

161161
Remember that the i2c_driver does not create those client handles. The
162162
handle may be used during foo_probe(). If foo_probe() reports success

arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int mcu_probe(struct i2c_client *client)
178178
return ret;
179179
}
180180

181-
static int mcu_remove(struct i2c_client *client)
181+
static void mcu_remove(struct i2c_client *client)
182182
{
183183
struct mcu *mcu = i2c_get_clientdata(client);
184184

@@ -193,7 +193,6 @@ static int mcu_remove(struct i2c_client *client)
193193

194194
mcu_gpiochip_remove(mcu);
195195
kfree(mcu);
196-
return 0;
197196
}
198197

199198
static const struct i2c_device_id mcu_ids[] = {

drivers/auxdisplay/ht16k33.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ static int ht16k33_probe(struct i2c_client *client)
775775
return err;
776776
}
777777

778-
static int ht16k33_remove(struct i2c_client *client)
778+
static void ht16k33_remove(struct i2c_client *client)
779779
{
780780
struct ht16k33_priv *priv = i2c_get_clientdata(client);
781781
struct ht16k33_fbdev *fbdev = &priv->fbdev;
@@ -796,8 +796,6 @@ static int ht16k33_remove(struct i2c_client *client)
796796
device_remove_file(&client->dev, &dev_attr_map_seg14);
797797
break;
798798
}
799-
800-
return 0;
801799
}
802800

803801
static const struct i2c_device_id ht16k33_i2c_match[] = {

drivers/auxdisplay/lcd2s.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,12 @@ static int lcd2s_i2c_probe(struct i2c_client *i2c)
340340
return err;
341341
}
342342

343-
static int lcd2s_i2c_remove(struct i2c_client *i2c)
343+
static void lcd2s_i2c_remove(struct i2c_client *i2c)
344344
{
345345
struct lcd2s_data *lcd2s = i2c_get_clientdata(i2c);
346346

347347
charlcd_unregister(lcd2s->charlcd);
348348
charlcd_free(lcd2s->charlcd);
349-
return 0;
350349
}
351350

352351
static const struct i2c_device_id lcd2s_i2c_id[] = {

drivers/char/ipmi/ipmb_dev_int.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,12 @@ static int ipmb_probe(struct i2c_client *client)
341341
return 0;
342342
}
343343

344-
static int ipmb_remove(struct i2c_client *client)
344+
static void ipmb_remove(struct i2c_client *client)
345345
{
346346
struct ipmb_dev *ipmb_dev = i2c_get_clientdata(client);
347347

348348
i2c_slave_unregister(client);
349349
misc_deregister(&ipmb_dev->miscdev);
350-
351-
return 0;
352350
}
353351

354352
static const struct i2c_device_id ipmb_id[] = {

drivers/char/ipmi/ipmi_ipmb.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ static void ipmi_ipmb_request_events(void *send_info)
424424
/* We don't fetch events here. */
425425
}
426426

427-
static int ipmi_ipmb_remove(struct i2c_client *client)
427+
static void ipmi_ipmb_remove(struct i2c_client *client)
428428
{
429429
struct ipmi_ipmb_dev *iidev = i2c_get_clientdata(client);
430430

@@ -438,8 +438,6 @@ static int ipmi_ipmb_remove(struct i2c_client *client)
438438
ipmi_ipmb_stop_thread(iidev);
439439

440440
ipmi_unregister_smi(iidev->intf);
441-
442-
return 0;
443441
}
444442

445443
static int ipmi_ipmb_probe(struct i2c_client *client)

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,13 +1281,13 @@ static void shutdown_ssif(void *send_info)
12811281
}
12821282
}
12831283

1284-
static int ssif_remove(struct i2c_client *client)
1284+
static void ssif_remove(struct i2c_client *client)
12851285
{
12861286
struct ssif_info *ssif_info = i2c_get_clientdata(client);
12871287
struct ssif_addr_info *addr_info;
12881288

12891289
if (!ssif_info)
1290-
return 0;
1290+
return;
12911291

12921292
/*
12931293
* After this point, we won't deliver anything asychronously
@@ -1303,8 +1303,6 @@ static int ssif_remove(struct i2c_client *client)
13031303
}
13041304

13051305
kfree(ssif_info);
1306-
1307-
return 0;
13081306
}
13091307

13101308
static int read_response(struct i2c_client *client, unsigned char *resp)

drivers/char/tpm/st33zp24/i2c.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,11 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
264264
* @param: client, the i2c_client description (TPM I2C description).
265265
* @return: 0 in case of success.
266266
*/
267-
static int st33zp24_i2c_remove(struct i2c_client *client)
267+
static void st33zp24_i2c_remove(struct i2c_client *client)
268268
{
269269
struct tpm_chip *chip = i2c_get_clientdata(client);
270270

271271
st33zp24_remove(chip);
272-
273-
return 0;
274272
}
275273

276274
static const struct i2c_device_id st33zp24_i2c_id[] = {

drivers/char/tpm/tpm_i2c_atmel.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,11 @@ static int i2c_atmel_probe(struct i2c_client *client,
179179
return tpm_chip_register(chip);
180180
}
181181

182-
static int i2c_atmel_remove(struct i2c_client *client)
182+
static void i2c_atmel_remove(struct i2c_client *client)
183183
{
184184
struct device *dev = &(client->dev);
185185
struct tpm_chip *chip = dev_get_drvdata(dev);
186186
tpm_chip_unregister(chip);
187-
return 0;
188187
}
189188

190189
static const struct i2c_device_id i2c_atmel_id[] = {

drivers/char/tpm/tpm_i2c_infineon.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,15 +706,13 @@ static int tpm_tis_i2c_probe(struct i2c_client *client,
706706
return rc;
707707
}
708708

709-
static int tpm_tis_i2c_remove(struct i2c_client *client)
709+
static void tpm_tis_i2c_remove(struct i2c_client *client)
710710
{
711711
struct tpm_chip *chip = tpm_dev.chip;
712712

713713
tpm_chip_unregister(chip);
714714
release_locality(chip, tpm_dev.locality, 1);
715715
tpm_dev.client = NULL;
716-
717-
return 0;
718716
}
719717

720718
static struct i2c_driver tpm_tis_i2c_driver = {

0 commit comments

Comments
 (0)