hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/mfd/tps80031.c
....@@ -30,7 +30,6 @@
3030 #include <linux/irq.h>
3131 #include <linux/mfd/core.h>
3232 #include <linux/mfd/tps80031.h>
33
-#include <linux/module.h>
3433 #include <linux/pm.h>
3534 #include <linux/regmap.h>
3635 #include <linux/slab.h>
....@@ -438,12 +437,11 @@
438437 if (tps80031_slave_address[i] == client->addr)
439438 tps80031->clients[i] = client;
440439 else
441
- tps80031->clients[i] = i2c_new_dummy(client->adapter,
442
- tps80031_slave_address[i]);
443
- if (!tps80031->clients[i]) {
440
+ tps80031->clients[i] = devm_i2c_new_dummy_device(&client->dev,
441
+ client->adapter, tps80031_slave_address[i]);
442
+ if (IS_ERR(tps80031->clients[i])) {
444443 dev_err(&client->dev, "can't attach client %d\n", i);
445
- ret = -ENOMEM;
446
- goto fail_client_reg;
444
+ return PTR_ERR(tps80031->clients[i]);
447445 }
448446
449447 i2c_set_clientdata(tps80031->clients[i], tps80031);
....@@ -453,7 +451,7 @@
453451 ret = PTR_ERR(tps80031->regmap[i]);
454452 dev_err(&client->dev,
455453 "regmap %d init failed, err %d\n", i, ret);
456
- goto fail_client_reg;
454
+ return ret;
457455 }
458456 }
459457
....@@ -462,7 +460,7 @@
462460 if (ret < 0) {
463461 dev_err(&client->dev,
464462 "Silicon version number read failed: %d\n", ret);
465
- goto fail_client_reg;
463
+ return ret;
466464 }
467465
468466 ret = tps80031_read(&client->dev, TPS80031_SLAVE_ID3,
....@@ -470,7 +468,7 @@
470468 if (ret < 0) {
471469 dev_err(&client->dev,
472470 "Silicon eeprom version read failed: %d\n", ret);
473
- goto fail_client_reg;
471
+ return ret;
474472 }
475473
476474 dev_info(&client->dev, "ES version 0x%02x and EPROM version 0x%02x\n",
....@@ -483,7 +481,7 @@
483481 ret = tps80031_irq_init(tps80031, client->irq, pdata->irq_base);
484482 if (ret) {
485483 dev_err(&client->dev, "IRQ init failed: %d\n", ret);
486
- goto fail_client_reg;
484
+ return ret;
487485 }
488486
489487 tps80031_pupd_init(tps80031, pdata);
....@@ -507,34 +505,7 @@
507505
508506 fail_mfd_add:
509507 regmap_del_irq_chip(client->irq, tps80031->irq_data);
510
-
511
-fail_client_reg:
512
- for (i = 0; i < TPS80031_NUM_SLAVES; i++) {
513
- if (tps80031->clients[i] && (tps80031->clients[i] != client))
514
- i2c_unregister_device(tps80031->clients[i]);
515
- }
516508 return ret;
517
-}
518
-
519
-static int tps80031_remove(struct i2c_client *client)
520
-{
521
- struct tps80031 *tps80031 = i2c_get_clientdata(client);
522
- int i;
523
-
524
- if (tps80031_power_off_dev == tps80031) {
525
- tps80031_power_off_dev = NULL;
526
- pm_power_off = NULL;
527
- }
528
-
529
- mfd_remove_devices(tps80031->dev);
530
-
531
- regmap_del_irq_chip(client->irq, tps80031->irq_data);
532
-
533
- for (i = 0; i < TPS80031_NUM_SLAVES; i++) {
534
- if (tps80031->clients[i] != client)
535
- i2c_unregister_device(tps80031->clients[i]);
536
- }
537
- return 0;
538509 }
539510
540511 static const struct i2c_device_id tps80031_id_table[] = {
....@@ -542,14 +513,13 @@
542513 { "tps80032", TPS80032 },
543514 { }
544515 };
545
-MODULE_DEVICE_TABLE(i2c, tps80031_id_table);
546516
547517 static struct i2c_driver tps80031_driver = {
548518 .driver = {
549
- .name = "tps80031",
519
+ .name = "tps80031",
520
+ .suppress_bind_attrs = true,
550521 },
551522 .probe = tps80031_probe,
552
- .remove = tps80031_remove,
553523 .id_table = tps80031_id_table,
554524 };
555525
....@@ -558,13 +528,3 @@
558528 return i2c_add_driver(&tps80031_driver);
559529 }
560530 subsys_initcall(tps80031_init);
561
-
562
-static void __exit tps80031_exit(void)
563
-{
564
- i2c_del_driver(&tps80031_driver);
565
-}
566
-module_exit(tps80031_exit);
567
-
568
-MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
569
-MODULE_DESCRIPTION("TPS80031 core driver");
570
-MODULE_LICENSE("GPL v2");