Skip to content

Commit ed5c2f5

Browse files
Uwe Kleine-Königwsakernel
Uwe Kleine-König
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 <[email protected]> Reviewed-by: Jeremy Kerr <[email protected]> Reviewed-by: Benjamin Mugnier <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Crt Mori <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Marek Behún <[email protected]> # for leds-turris-omnia Acked-by: Andy Shevchenko <[email protected]> Reviewed-by: Petr Machata <[email protected]> # for mlxsw Reviewed-by: Maximilian Luz <[email protected]> # for surface3_power Acked-by: Srinivas Pandruvada <[email protected]> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <[email protected]> # for media/* + staging/media/* Acked-by: Miguel Ojeda <[email protected]> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <[email protected]> # for versaclock5 Reviewed-by: Ajay Gupta <[email protected]> # for ucsi_ccg Acked-by: Jonathan Cameron <[email protected]> # for iio Acked-by: Peter Rosin <[email protected]> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <[email protected]> # for lontium-lt8912b Reviewed-by: Jean Delvare <[email protected]> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <[email protected]> # for IPMI Reviewed-by: Vladimir Oltean <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Sebastian Reichel <[email protected]> # for drivers/power Acked-by: Krzysztof Hałasa <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
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

+1-1
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

+1-2
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

+1-3
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

+1-2
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

+1-3
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

+1-3
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

+2-4
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

+1-3
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

+1-2
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

+1-3
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 = {

drivers/char/tpm/tpm_i2c_nuvoton.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -622,12 +622,11 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
622622
return tpm_chip_register(chip);
623623
}
624624

625-
static int i2c_nuvoton_remove(struct i2c_client *client)
625+
static void i2c_nuvoton_remove(struct i2c_client *client)
626626
{
627627
struct tpm_chip *chip = i2c_get_clientdata(client);
628628

629629
tpm_chip_unregister(chip);
630-
return 0;
631630
}
632631

633632
static const struct i2c_device_id i2c_nuvoton_id[] = {

drivers/char/tpm/tpm_tis_i2c.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,12 @@ static int tpm_tis_i2c_probe(struct i2c_client *dev,
351351
NULL);
352352
}
353353

354-
static int tpm_tis_i2c_remove(struct i2c_client *client)
354+
static void tpm_tis_i2c_remove(struct i2c_client *client)
355355
{
356356
struct tpm_chip *chip = i2c_get_clientdata(client);
357357

358358
tpm_chip_unregister(chip);
359359
tpm_tis_remove(chip);
360-
return 0;
361360
}
362361

363362
static const struct i2c_device_id tpm_tis_i2c_id[] = {

drivers/char/tpm/tpm_tis_i2c_cr50.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -763,20 +763,18 @@ static int tpm_cr50_i2c_probe(struct i2c_client *client)
763763
* - 0: Success.
764764
* - -errno: A POSIX error code.
765765
*/
766-
static int tpm_cr50_i2c_remove(struct i2c_client *client)
766+
static void tpm_cr50_i2c_remove(struct i2c_client *client)
767767
{
768768
struct tpm_chip *chip = i2c_get_clientdata(client);
769769
struct device *dev = &client->dev;
770770

771771
if (!chip) {
772772
dev_crit(dev, "Could not get client data at remove, memory corruption ahead\n");
773-
return 0;
773+
return;
774774
}
775775

776776
tpm_chip_unregister(chip);
777777
tpm_cr50_release_locality(chip, true);
778-
779-
return 0;
780778
}
781779

782780
static SIMPLE_DEV_PM_OPS(cr50_i2c_pm, tpm_pm_suspend, tpm_pm_resume);

drivers/clk/clk-cdce706.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -665,10 +665,9 @@ static int cdce706_probe(struct i2c_client *client)
665665
cdce);
666666
}
667667

668-
static int cdce706_remove(struct i2c_client *client)
668+
static void cdce706_remove(struct i2c_client *client)
669669
{
670670
of_clk_del_provider(client->dev.of_node);
671-
return 0;
672671
}
673672

674673

drivers/clk/clk-cs2000-cp.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ static int cs2000_version_print(struct cs2000_priv *priv)
557557
return 0;
558558
}
559559

560-
static int cs2000_remove(struct i2c_client *client)
560+
static void cs2000_remove(struct i2c_client *client)
561561
{
562562
struct cs2000_priv *priv = i2c_get_clientdata(client);
563563
struct device *dev = priv_to_dev(priv);
@@ -566,8 +566,6 @@ static int cs2000_remove(struct i2c_client *client)
566566
of_clk_del_provider(np);
567567

568568
clk_hw_unregister(&priv->hw);
569-
570-
return 0;
571569
}
572570

573571
static int cs2000_probe(struct i2c_client *client)

drivers/clk/clk-si514.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,9 @@ static int si514_probe(struct i2c_client *client)
370370
return 0;
371371
}
372372

373-
static int si514_remove(struct i2c_client *client)
373+
static void si514_remove(struct i2c_client *client)
374374
{
375375
of_clk_del_provider(client->dev.of_node);
376-
return 0;
377376
}
378377

379378
static const struct i2c_device_id si514_id[] = {

drivers/clk/clk-si5341.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ static int si5341_probe(struct i2c_client *client)
17961796
return err;
17971797
}
17981798

1799-
static int si5341_remove(struct i2c_client *client)
1799+
static void si5341_remove(struct i2c_client *client)
18001800
{
18011801
struct clk_si5341 *data = i2c_get_clientdata(client);
18021802
int i;
@@ -1807,8 +1807,6 @@ static int si5341_remove(struct i2c_client *client)
18071807
if (data->clk[i].vddo_reg)
18081808
regulator_disable(data->clk[i].vddo_reg);
18091809
}
1810-
1811-
return 0;
18121810
}
18131811

18141812
static const struct i2c_device_id si5341_id[] = {

drivers/clk/clk-si5351.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1651,11 +1651,9 @@ static int si5351_i2c_probe(struct i2c_client *client)
16511651
return 0;
16521652
}
16531653

1654-
static int si5351_i2c_remove(struct i2c_client *client)
1654+
static void si5351_i2c_remove(struct i2c_client *client)
16551655
{
16561656
of_clk_del_provider(client->dev.of_node);
1657-
1658-
return 0;
16591657
}
16601658

16611659
static struct i2c_driver si5351_driver = {

drivers/clk/clk-si570.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,9 @@ static int si570_probe(struct i2c_client *client)
498498
return 0;
499499
}
500500

501-
static int si570_remove(struct i2c_client *client)
501+
static void si570_remove(struct i2c_client *client)
502502
{
503503
of_clk_del_provider(client->dev.of_node);
504-
return 0;
505504
}
506505

507506
static const struct of_device_id clk_si570_of_match[] = {

drivers/clk/clk-versaclock5.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1138,16 +1138,14 @@ static int vc5_probe(struct i2c_client *client)
11381138
return ret;
11391139
}
11401140

1141-
static int vc5_remove(struct i2c_client *client)
1141+
static void vc5_remove(struct i2c_client *client)
11421142
{
11431143
struct vc5_driver_data *vc5 = i2c_get_clientdata(client);
11441144

11451145
of_clk_del_provider(client->dev.of_node);
11461146

11471147
if (vc5->chip_info->flags & VC5_HAS_INTERNAL_XTAL)
11481148
clk_unregister_fixed_rate(vc5->pin_xin);
1149-
1150-
return 0;
11511149
}
11521150

11531151
static int __maybe_unused vc5_suspend(struct device *dev)

drivers/crypto/atmel-ecc.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static int atmel_ecc_probe(struct i2c_client *client,
343343
return ret;
344344
}
345345

346-
static int atmel_ecc_remove(struct i2c_client *client)
346+
static void atmel_ecc_remove(struct i2c_client *client)
347347
{
348348
struct atmel_i2c_client_priv *i2c_priv = i2c_get_clientdata(client);
349349

@@ -358,16 +358,14 @@ static int atmel_ecc_remove(struct i2c_client *client)
358358
* accessing the freed memory.
359359
*/
360360
dev_emerg(&client->dev, "Device is busy, expect memory corruption.\n");
361-
return 0;
361+
return;
362362
}
363363

364364
crypto_unregister_kpp(&atmel_ecdh_nist_p256);
365365

366366
spin_lock(&driver_data.i2c_list_lock);
367367
list_del(&i2c_priv->i2c_client_list_node);
368368
spin_unlock(&driver_data.i2c_list_lock);
369-
370-
return 0;
371369
}
372370

373371
#ifdef CONFIG_OF

drivers/crypto/atmel-sha204a.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,16 @@ static int atmel_sha204a_probe(struct i2c_client *client,
116116
return ret;
117117
}
118118

119-
static int atmel_sha204a_remove(struct i2c_client *client)
119+
static void atmel_sha204a_remove(struct i2c_client *client)
120120
{
121121
struct atmel_i2c_client_priv *i2c_priv = i2c_get_clientdata(client);
122122

123123
if (atomic_read(&i2c_priv->tfm_count)) {
124124
dev_emerg(&client->dev, "Device is busy, will remove it anyhow\n");
125-
return 0;
125+
return;
126126
}
127127

128128
kfree((void *)i2c_priv->hwrng.priv);
129-
130-
return 0;
131129
}
132130

133131
static const struct of_device_id atmel_sha204a_dt_ids[] = {

drivers/extcon/extcon-rt8973a.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,11 @@ static int rt8973a_muic_i2c_probe(struct i2c_client *i2c,
646646
return 0;
647647
}
648648

649-
static int rt8973a_muic_i2c_remove(struct i2c_client *i2c)
649+
static void rt8973a_muic_i2c_remove(struct i2c_client *i2c)
650650
{
651651
struct rt8973a_muic_info *info = i2c_get_clientdata(i2c);
652652

653653
regmap_del_irq_chip(info->irq, info->irq_data);
654-
655-
return 0;
656654
}
657655

658656
static const struct of_device_id rt8973a_dt_match[] = {

drivers/gpio/gpio-adp5588.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,12 @@ static int adp5588_gpio_probe(struct i2c_client *client)
409409
return 0;
410410
}
411411

412-
static int adp5588_gpio_remove(struct i2c_client *client)
412+
static void adp5588_gpio_remove(struct i2c_client *client)
413413
{
414414
struct adp5588_gpio *dev = i2c_get_clientdata(client);
415415

416416
if (dev->client->irq)
417417
free_irq(dev->client->irq, dev);
418-
419-
return 0;
420418
}
421419

422420
static const struct i2c_device_id adp5588_gpio_id[] = {

0 commit comments

Comments
 (0)