]> www.infradead.org Git - users/willy/xarray.git/commitdiff
hwmon: Remove devm_hwmon_device_unregister() API function
authorGuenter Roeck <linux@roeck-us.net>
Fri, 13 Sep 2024 14:11:42 +0000 (07:11 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 13 Sep 2024 14:27:36 +0000 (07:27 -0700)
devm_hwmon_device_unregister() has no in-tree user, and its implementation
is wrong since it does not pass the to-be-removed hardware monitoring
device as parameter. I do not envision a valid use for it; drivers needing
it should not have called devm_hwmon_device_register_with_info() in the
first place. Remove it.

Reported-by: Matthew Sanders <m@ttsande.rs>
Closes: https://lore.kernel.org/linux-hwmon/488b3bdf870ea76c4b943dbe5fd15ac8113019dc.camel@kernel.org/
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Documentation/hwmon/hwmon-kernel-api.rst
drivers/hwmon/hwmon.c
include/linux/hwmon.h

index 6cacf7daf25c049fcd6ebf369df668f7948c45a7..8297acfa3a2d822139c63097ab48eeaf551e295d 100644 (file)
@@ -38,8 +38,6 @@ register/unregister functions::
 
   void hwmon_device_unregister(struct device *dev);
 
-  void devm_hwmon_device_unregister(struct device *dev);
-
   char *hwmon_sanitize_name(const char *name);
 
   char *devm_hwmon_sanitize_name(struct device *dev, const char *name);
@@ -64,11 +62,6 @@ monitoring device structure. This function must be called from the driver
 remove function if the hardware monitoring device was registered with
 hwmon_device_register_with_info.
 
-devm_hwmon_device_unregister does not normally have to be called. It is only
-needed for error handling, and only needed if the driver probe fails after
-the call to devm_hwmon_device_register_with_info and if the automatic (device
-managed) removal would be too late.
-
 All supported hwmon device registration functions only accept valid device
 names. Device names including invalid characters (whitespace, '*', or '-')
 will be rejected. The 'name' parameter is mandatory.
index a362080d41fa825dca23f484ce642bd442d0c1be..9c35c4d0369d7aad7ea61ccd25f4f63fc98b9e02 100644 (file)
@@ -1188,24 +1188,6 @@ error:
 }
 EXPORT_SYMBOL_GPL(devm_hwmon_device_register_with_info);
 
-static int devm_hwmon_match(struct device *dev, void *res, void *data)
-{
-       struct device **hwdev = res;
-
-       return *hwdev == data;
-}
-
-/**
- * devm_hwmon_device_unregister - removes a previously registered hwmon device
- *
- * @dev: the parent device of the device to unregister
- */
-void devm_hwmon_device_unregister(struct device *dev)
-{
-       WARN_ON(devres_release(dev, devm_hwmon_release, devm_hwmon_match, dev));
-}
-EXPORT_SYMBOL_GPL(devm_hwmon_device_unregister);
-
 static char *__hwmon_sanitize_name(struct device *dev, const char *old_name)
 {
        char *name, *p;
index e94314760aab00c04c729941f3cc475b5fd68a11..5c6a421ad580518bcf0b5b6edd9432a48c40d4f3 100644 (file)
@@ -481,7 +481,6 @@ devm_hwmon_device_register_with_info(struct device *dev,
                                const struct attribute_group **extra_groups);
 
 void hwmon_device_unregister(struct device *dev);
-void devm_hwmon_device_unregister(struct device *dev);
 
 int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,
                       u32 attr, int channel);