Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: Remove devm_hwmon_device_unregister() API function

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>

-26
-7
Documentation/hwmon/hwmon-kernel-api.rst
··· 38 38 39 39 void hwmon_device_unregister(struct device *dev); 40 40 41 - void devm_hwmon_device_unregister(struct device *dev); 42 - 43 41 char *hwmon_sanitize_name(const char *name); 44 42 45 43 char *devm_hwmon_sanitize_name(struct device *dev, const char *name); ··· 61 63 monitoring device structure. This function must be called from the driver 62 64 remove function if the hardware monitoring device was registered with 63 65 hwmon_device_register_with_info. 64 - 65 - devm_hwmon_device_unregister does not normally have to be called. It is only 66 - needed for error handling, and only needed if the driver probe fails after 67 - the call to devm_hwmon_device_register_with_info and if the automatic (device 68 - managed) removal would be too late. 69 66 70 67 All supported hwmon device registration functions only accept valid device 71 68 names. Device names including invalid characters (whitespace, '*', or '-')
-18
drivers/hwmon/hwmon.c
··· 1188 1188 } 1189 1189 EXPORT_SYMBOL_GPL(devm_hwmon_device_register_with_info); 1190 1190 1191 - static int devm_hwmon_match(struct device *dev, void *res, void *data) 1192 - { 1193 - struct device **hwdev = res; 1194 - 1195 - return *hwdev == data; 1196 - } 1197 - 1198 - /** 1199 - * devm_hwmon_device_unregister - removes a previously registered hwmon device 1200 - * 1201 - * @dev: the parent device of the device to unregister 1202 - */ 1203 - void devm_hwmon_device_unregister(struct device *dev) 1204 - { 1205 - WARN_ON(devres_release(dev, devm_hwmon_release, devm_hwmon_match, dev)); 1206 - } 1207 - EXPORT_SYMBOL_GPL(devm_hwmon_device_unregister); 1208 - 1209 1191 static char *__hwmon_sanitize_name(struct device *dev, const char *old_name) 1210 1192 { 1211 1193 char *name, *p;
-1
include/linux/hwmon.h
··· 481 481 const struct attribute_group **extra_groups); 482 482 483 483 void hwmon_device_unregister(struct device *dev); 484 - void devm_hwmon_device_unregister(struct device *dev); 485 484 486 485 int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type, 487 486 u32 attr, int channel);