hwmon: (pmbus) shrink code and remove pmbus_do_remove()
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 26 Oct 2020 10:53:52 +0000 (11:53 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 3 Dec 2020 01:42:23 +0000 (17:42 -0800)
The only action currently performed in pmbus_do_remove() is removing the
debugfs hierarchy. We can schedule a devm action at probe time and remove
pmbus_do_remove() entirely from all pmbus drivers.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20201026105352.20359-1-brgl@bgdev.pl
[groeck: Removed references to pmbus_do_remove from documentation]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
32 files changed:
Documentation/hwmon/pmbus-core.rst
Documentation/hwmon/pmbus.rst
drivers/hwmon/pmbus/adm1266.c
drivers/hwmon/pmbus/adm1275.c
drivers/hwmon/pmbus/bel-pfe.c
drivers/hwmon/pmbus/ibm-cffps.c
drivers/hwmon/pmbus/inspur-ipsps.c
drivers/hwmon/pmbus/ir35221.c
drivers/hwmon/pmbus/ir38064.c
drivers/hwmon/pmbus/irps5401.c
drivers/hwmon/pmbus/isl68137.c
drivers/hwmon/pmbus/lm25066.c
drivers/hwmon/pmbus/ltc2978.c
drivers/hwmon/pmbus/ltc3815.c
drivers/hwmon/pmbus/max16064.c
drivers/hwmon/pmbus/max16601.c
drivers/hwmon/pmbus/max20730.c
drivers/hwmon/pmbus/max20751.c
drivers/hwmon/pmbus/max31785.c
drivers/hwmon/pmbus/max34440.c
drivers/hwmon/pmbus/max8688.c
drivers/hwmon/pmbus/mp2975.c
drivers/hwmon/pmbus/pmbus.c
drivers/hwmon/pmbus/pmbus.h
drivers/hwmon/pmbus/pmbus_core.c
drivers/hwmon/pmbus/pxe1610.c
drivers/hwmon/pmbus/tps40422.c
drivers/hwmon/pmbus/tps53679.c
drivers/hwmon/pmbus/ucd9000.c
drivers/hwmon/pmbus/ucd9200.c
drivers/hwmon/pmbus/xdpe12284.c
drivers/hwmon/pmbus/zl6100.c

index e22c4f6808bc85a0c48975cfee05b58e2acddea8..73e23ab42cc3ae536437fcf4d0d4387d2c849dea 100644 (file)
@@ -277,12 +277,6 @@ with the pointer to struct pmbus_driver_info as additional argument. Calls
 identify function if supported. Must only be called from device probe
 function.
 
-::
-
-  void pmbus_do_remove(struct i2c_client *client);
-
-Execute driver remove function. Similar to standard driver remove function.
-
 ::
 
   const struct pmbus_driver_info
index fb3ad67dedc12a9525945b89d68ef9be4bd39f2f..c44f14115413dbb18d27d348ce447c2f614c1f02 100644 (file)
@@ -148,11 +148,6 @@ Emerson DS1200 power modules might look as follows::
        return pmbus_do_probe(client, &ds1200_info);
   }
 
-  static int ds1200_remove(struct i2c_client *client)
-  {
-       return pmbus_do_remove(client);
-  }
-
   static const struct i2c_device_id ds1200_id[] = {
        {"ds1200", 0},
        {}
@@ -166,7 +161,6 @@ Emerson DS1200 power modules might look as follows::
                   .name = "ds1200",
                   },
        .probe_new = ds1200_probe,
-       .remove = ds1200_remove,
        .id_table = ds1200_id,
   };
 
index c7b373ba92f211a2f22212aecca4c1e26956e898..4d2e4ddcfbfdd985e983f37fe03ba79c7db6ce4a 100644 (file)
@@ -502,7 +502,6 @@ static struct i2c_driver adm1266_driver = {
                   .of_match_table = adm1266_of_match,
                  },
        .probe_new = adm1266_probe,
-       .remove = pmbus_do_remove,
        .id_table = adm1266_id,
 };
 
index e7997f37b2666fcbab8a1347185ac58c7fbed3a5..38a6515b07634ffdb01622f13fcc9c22f5ae72cf 100644 (file)
@@ -797,7 +797,6 @@ static struct i2c_driver adm1275_driver = {
                   .name = "adm1275",
                   },
        .probe_new = adm1275_probe,
-       .remove = pmbus_do_remove,
        .id_table = adm1275_id,
 };
 
index 2c5b853d6c7fc3da69913c2ca4c86b3df1d0f9d2..aed7542d7ce54224a71b58014f8b03a39285da5c 100644 (file)
@@ -121,7 +121,6 @@ static struct i2c_driver pfe_pmbus_driver = {
                   .name = "bel-pfe",
        },
        .probe_new = pfe_pmbus_probe,
-       .remove = pmbus_do_remove,
        .id_table = pfe_device_id,
 };
 
index 2fb7540ee952b5984c1bc558cb99de4a12eb6a67..d6bbbb223871b3fe3a289b11b386599e484d39d1 100644 (file)
@@ -617,7 +617,6 @@ static struct i2c_driver ibm_cffps_driver = {
                .of_match_table = ibm_cffps_of_match,
        },
        .probe_new = ibm_cffps_probe,
-       .remove = pmbus_do_remove,
        .id_table = ibm_cffps_id,
 };
 
index be493182174deb7921091be8ab1ce8a42b15ad66..88c5865c4d6f8d29db86479aec11c7cd74b548e3 100644 (file)
@@ -216,7 +216,6 @@ static struct i2c_driver ipsps_driver = {
                .of_match_table = of_match_ptr(ipsps_of_match),
        },
        .probe_new = ipsps_probe,
-       .remove = pmbus_do_remove,
        .id_table = ipsps_id,
 };
 
index 5fadb1def49fbfbec51938eb6ad33f9421917e1c..3aebeb1443fdf70028549e32b43bb4174132c155 100644 (file)
@@ -137,7 +137,6 @@ static struct i2c_driver ir35221_driver = {
                .name   = "ir35221",
        },
        .probe_new      = ir35221_probe,
-       .remove         = pmbus_do_remove,
        .id_table       = ir35221_id,
 };
 
index 9ac563ce7dd8ab513cfe503a86cdf53e17027d59..46f17c4b48733ec5fa5accaed8f22a34e5e8ed3e 100644 (file)
@@ -53,7 +53,6 @@ static struct i2c_driver ir38064_driver = {
                   .name = "ir38064",
                   },
        .probe_new = ir38064_probe,
-       .remove = pmbus_do_remove,
        .id_table = ir38064_id,
 };
 
index 44aeafcbd56cbd2a13f15166c31b6644af08e91f..93ef6d64a33ae06791cad5eae89010dfcc53142a 100644 (file)
@@ -55,7 +55,6 @@ static struct i2c_driver irps5401_driver = {
                   .name = "irps5401",
                   },
        .probe_new = irps5401_probe,
-       .remove = pmbus_do_remove,
        .id_table = irps5401_id,
 };
 
index 7cad76e07f701bcc0ac9310a22dfa0963d037670..2bee930d39002150c3854b937a22553c27a1413a 100644 (file)
@@ -324,7 +324,6 @@ static struct i2c_driver isl68137_driver = {
                   .name = "isl68137",
                   },
        .probe_new = isl68137_probe,
-       .remove = pmbus_do_remove,
        .id_table = raa_dmpvr_id,
 };
 
index 429172a42902c8181ffbe7e2b01875c9a3a2a449..c75a6bf39641128fe8171f608644cfb9889dd970 100644 (file)
@@ -508,7 +508,6 @@ static struct i2c_driver lm25066_driver = {
                   .name = "lm25066",
                   },
        .probe_new = lm25066_probe,
-       .remove = pmbus_do_remove,
        .id_table = lm25066_id,
 };
 
index 9a024cf70145fef82fbbfaf5dc7b36532eae3fe1..7e53fa95b92dbb5e8f472e7361da4bc1c48ed64c 100644 (file)
@@ -875,7 +875,6 @@ static struct i2c_driver ltc2978_driver = {
                   .of_match_table = of_match_ptr(ltc2978_of_match),
                   },
        .probe_new = ltc2978_probe,
-       .remove = pmbus_do_remove,
        .id_table = ltc2978_id,
 };
 
index 8328fb367ad67e7de7b57b963a6a3604d80aea0b..e45e14d26c9a35fa402786e94af0d975f03aa951 100644 (file)
@@ -200,7 +200,6 @@ static struct i2c_driver ltc3815_driver = {
                   .name = "ltc3815",
                   },
        .probe_new = ltc3815_probe,
-       .remove = pmbus_do_remove,
        .id_table = ltc3815_id,
 };
 
index 26e7f5ef9d7f28530f0b8fb658877edfeb3b8346..d79add99083ee806f8b58aafc821326c98d3ca2f 100644 (file)
@@ -103,7 +103,6 @@ static struct i2c_driver max16064_driver = {
                   .name = "max16064",
                   },
        .probe_new = max16064_probe,
-       .remove = pmbus_do_remove,
        .id_table = max16064_id,
 };
 
index 71bb74e27a5c8f32989857616d5e9153626a6d88..a960b86e72d23988404d3a41be8838a1e5f8e92c 100644 (file)
@@ -302,7 +302,6 @@ static struct i2c_driver max16601_driver = {
                   .name = "max16601",
                   },
        .probe_new = max16601_probe,
-       .remove = pmbus_do_remove,
        .id_table = max16601_id,
 };
 
index 00fea16acab477b2e6e6ddbd9d95eee877c4a73d..9dd3dd79bc182d3e71c2188578101d3ff279c8f3 100644 (file)
@@ -777,7 +777,6 @@ static struct i2c_driver max20730_driver = {
                .of_match_table = max20730_of_match,
        },
        .probe_new = max20730_probe,
-       .remove = pmbus_do_remove,
        .id_table = max20730_id,
 };
 
index 921e92d82aec898809aa531bc111a487dceb3b61..9d42f82fdd997d93def8f9c8559fdee8a27f4ed7 100644 (file)
@@ -43,7 +43,6 @@ static struct i2c_driver max20751_driver = {
                   .name = "max20751",
                   },
        .probe_new = max20751_probe,
-       .remove = pmbus_do_remove,
        .id_table = max20751_id,
 };
 
index 839b957bc03e71281cce4863259f57dd80a489f0..e5a9f4019cd50d7195967b7353e1abc583d3c1f5 100644 (file)
@@ -390,7 +390,6 @@ static struct i2c_driver max31785_driver = {
                .of_match_table = max31785_of_match,
        },
        .probe_new = max31785_probe,
-       .remove = pmbus_do_remove,
        .id_table = max31785_id,
 };
 
index f4cb196aaaf31468edae8701ad4ad02db4ad9ba2..dad66b3c0116831d1b38781afb03962f6111414b 100644 (file)
@@ -521,7 +521,6 @@ static struct i2c_driver max34440_driver = {
                   .name = "max34440",
                   },
        .probe_new = max34440_probe,
-       .remove = pmbus_do_remove,
        .id_table = max34440_id,
 };
 
index 4b2239a6afd3785ed8d6d3da7b35fe503e15270b..329dc851fc5908586e9b5ba0d6604d9984de1980 100644 (file)
@@ -183,7 +183,6 @@ static struct i2c_driver max8688_driver = {
                   .name = "max8688",
                   },
        .probe_new = max8688_probe,
-       .remove = pmbus_do_remove,
        .id_table = max8688_id,
 };
 
index 1c3e2a9453b125848b39080ce43bf6ee04103fa3..60fbdb3713326030f38eea1afd79162cad79f842 100644 (file)
@@ -758,7 +758,6 @@ static struct i2c_driver mp2975_driver = {
                .of_match_table = of_match_ptr(mp2975_of_match),
        },
        .probe_new = mp2975_probe,
-       .remove = pmbus_do_remove,
        .id_table = mp2975_id,
 };
 
index 20f1af9165c2d9fa535014ea4bf96a6dcb1e698e..a1b4260e75b2ce1ecee7068c72fe3b47dd40d9ce 100644 (file)
@@ -238,7 +238,6 @@ static struct i2c_driver pmbus_driver = {
                   .name = "pmbus",
                   },
        .probe_new = pmbus_probe,
-       .remove = pmbus_do_remove,
        .id_table = pmbus_id,
 };
 
index 88a5df2633fb254cbbf6474eae59899eb7ec0081..4c30ec89f5bf82b55e6639211e8b95538baa3e73 100644 (file)
@@ -490,7 +490,6 @@ void pmbus_clear_faults(struct i2c_client *client);
 bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg);
 bool pmbus_check_word_register(struct i2c_client *client, int page, int reg);
 int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
-int pmbus_do_remove(struct i2c_client *client);
 const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client
                                                      *client);
 int pmbus_get_fan_rate_device(struct i2c_client *client, int page, int id,
index b0e2820a2d578f62ca0db7ac565ca5404065c790..192442b3b7a287424977d1f035a7378c06df57c2 100644 (file)
@@ -2395,6 +2395,13 @@ static int pmbus_debugfs_set_pec(void *data, u64 val)
 DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
                         pmbus_debugfs_set_pec, "%llu\n");
 
+static void pmbus_remove_debugfs(void *data)
+{
+       struct dentry *entry = data;
+
+       debugfs_remove_recursive(entry);
+}
+
 static int pmbus_init_debugfs(struct i2c_client *client,
                              struct pmbus_data *data)
 {
@@ -2530,7 +2537,8 @@ static int pmbus_init_debugfs(struct i2c_client *client,
                }
        }
 
-       return 0;
+       return devm_add_action_or_reset(data->dev,
+                                       pmbus_remove_debugfs, data->debugfs);
 }
 #else
 static int pmbus_init_debugfs(struct i2c_client *client,
@@ -2617,16 +2625,6 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
 }
 EXPORT_SYMBOL_GPL(pmbus_do_probe);
 
-int pmbus_do_remove(struct i2c_client *client)
-{
-       struct pmbus_data *data = i2c_get_clientdata(client);
-
-       debugfs_remove_recursive(data->debugfs);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(pmbus_do_remove);
-
 struct dentry *pmbus_get_debugfs_dir(struct i2c_client *client)
 {
        struct pmbus_data *data = i2c_get_clientdata(client);
index fa5c5dd29b7ae047d17d3ad212ee081dcba30edf..da27ce34ee3fd05153e44b0908a3a32ee2be9235 100644 (file)
@@ -131,7 +131,6 @@ static struct i2c_driver pxe1610_driver = {
                        .name = "pxe1610",
                        },
        .probe_new = pxe1610_probe,
-       .remove = pmbus_do_remove,
        .id_table = pxe1610_id,
 };
 
index edbdfa809d51d7692d50924d6da77d4cfb1baaa2..f7f00ab6f46c687e790b3457b6754f9e884fb2ef 100644 (file)
@@ -43,7 +43,6 @@ static struct i2c_driver tps40422_driver = {
                   .name = "tps40422",
                   },
        .probe_new = tps40422_probe,
-       .remove = pmbus_do_remove,
        .id_table = tps40422_id,
 };
 
index db2bdf2a1f023a86559f0c853c9192956571b5a0..ba838fa311c3aad94089d98d6cf5222b450ecf02 100644 (file)
@@ -251,7 +251,6 @@ static struct i2c_driver tps53679_driver = {
                .of_match_table = of_match_ptr(tps53679_of_match),
        },
        .probe_new = tps53679_probe,
-       .remove = pmbus_do_remove,
        .id_table = tps53679_id,
 };
 
index f8017993e2b4dd2005a58b1245e78cb4c4162477..a15e6fe3e425a3cab4cfbb3cb9011bdb4fcca517 100644 (file)
@@ -621,7 +621,6 @@ static struct i2c_driver ucd9000_driver = {
                .of_match_table = of_match_ptr(ucd9000_of_match),
        },
        .probe_new = ucd9000_probe,
-       .remove = pmbus_do_remove,
        .id_table = ucd9000_id,
 };
 
index e111e25e1619a3a13e5d485b07b6ccf7c39f630e..47cc7ca9d32998aca8e40df220ce326236864e0b 100644 (file)
@@ -201,7 +201,6 @@ static struct i2c_driver ucd9200_driver = {
                .of_match_table = of_match_ptr(ucd9200_of_match),
        },
        .probe_new = ucd9200_probe,
-       .remove = pmbus_do_remove,
        .id_table = ucd9200_id,
 };
 
index c95ac934fde416818d321138c405b3700f52e749..f8bc0f41cd5fae1807bc94c7698d6ec2a340976c 100644 (file)
@@ -160,7 +160,6 @@ static struct i2c_driver xdpe122_driver = {
                .of_match_table = of_match_ptr(xdpe122_of_match),
        },
        .probe_new = xdpe122_probe,
-       .remove = pmbus_do_remove,
        .id_table = xdpe122_id,
 };
 
index e8bda340482be850860fd5168016002f4a040fb1..69120ca7aaa861fd92c769e912765a382afa820f 100644 (file)
@@ -396,7 +396,6 @@ static struct i2c_driver zl6100_driver = {
                   .name = "zl6100",
                   },
        .probe_new = zl6100_probe,
-       .remove = pmbus_do_remove,
        .id_table = zl6100_id,
 };