History

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.

Guenter Roeck committed 2 years ago

Commit 2cb4acf1 parent 3017d283 files · +0 −26Browse files

Unified · Split

3 files
  1. Documentation/hwmon/hwmon-kernel-api.rst +0 −7
  2. drivers/hwmon/hwmon.c +0 −18
  3. include/linux/hwmon.h +0 −1
Documentation/hwmon/hwmon-kernel-api.rst+0−7
@@ -38,8 +38,6 @@ register/unregister functions:: · 37 unmodified lines
38 38
39 void hwmon_device_unregister(struct device *dev);39 void hwmon_device_unregister(struct device *dev);
40 40
41 void devm_hwmon_device_unregister(struct device *dev);
42
43 char *hwmon_sanitize_name(const char *name);41 char *hwmon_sanitize_name(const char *name);
44 42
45 char *devm_hwmon_sanitize_name(struct device *dev, const char *name);43 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 · 18 unmodified lines
64remove function if the hardware monitoring device was registered with62remove function if the hardware monitoring device was registered with
65hwmon_device_register_with_info.63hwmon_device_register_with_info.
66 64
67devm_hwmon_device_unregister does not normally have to be called. It is only
68needed for error handling, and only needed if the driver probe fails after
69the call to devm_hwmon_device_register_with_info and if the automatic (device
70managed) removal would be too late.
71
72All supported hwmon device registration functions only accept valid device65All supported hwmon device registration functions only accept valid device
73names. Device names including invalid characters (whitespace, '*', or '-')66names. Device names including invalid characters (whitespace, '*', or '-')
74will be rejected. The 'name' parameter is mandatory.67will be rejected. The 'name' parameter is mandatory.
drivers/hwmon/hwmon.c+0−18
@@ -1188,24 +1188,6 @@ error: · 1187 unmodified lines
1188}1188}
1189EXPORT_SYMBOL_GPL(devm_hwmon_device_register_with_info);1189EXPORT_SYMBOL_GPL(devm_hwmon_device_register_with_info);
1190 1190
1191static 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 */
1203void devm_hwmon_device_unregister(struct device *dev)
1204{
1205 WARN_ON(devres_release(dev, devm_hwmon_release, devm_hwmon_match, dev));
1206}
1207EXPORT_SYMBOL_GPL(devm_hwmon_device_unregister);
1208
1209static char *__hwmon_sanitize_name(struct device *dev, const char *old_name)1191static char *__hwmon_sanitize_name(struct device *dev, const char *old_name)
1210{1192{
1211 char *name, *p;1193 char *name, *p;
include/linux/hwmon.h+0−1
@@ -481,7 +481,6 @@ devm_hwmon_device_register_with_info(struct device *dev, · 480 unmodified lines
481 const struct attribute_group **extra_groups);481 const struct attribute_group **extra_groups);
482 482
483void hwmon_device_unregister(struct device *dev);483void hwmon_device_unregister(struct device *dev);
484void devm_hwmon_device_unregister(struct device *dev);
485 484
486int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,485int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,
487 u32 attr, int channel);486 u32 attr, int channel);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t