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.
Unified · Split
| @@ -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 | |||
| 64 | remove function if the hardware monitoring device was registered with | 62 | remove function if the hardware monitoring device was registered with |
| 65 | hwmon_device_register_with_info. | 63 | hwmon_device_register_with_info. |
| 66 | 64 | ||
| 67 | devm_hwmon_device_unregister does not normally have to be called. It is only | ||
| 68 | needed for error handling, and only needed if the driver probe fails after | ||
| 69 | the call to devm_hwmon_device_register_with_info and if the automatic (device | ||
| 70 | managed) removal would be too late. | ||
| 71 | |||
| 72 | All supported hwmon device registration functions only accept valid device | 65 | All supported hwmon device registration functions only accept valid device |
| 73 | names. Device names including invalid characters (whitespace, '*', or '-') | 66 | names. Device names including invalid characters (whitespace, '*', or '-') |
| 74 | will be rejected. The 'name' parameter is mandatory. | 67 | will be rejected. The 'name' parameter is mandatory. |
| @@ -1188,24 +1188,6 @@ error: · 1187 unmodified lines | |||
| 1188 | } | 1188 | } |
| 1189 | EXPORT_SYMBOL_GPL(devm_hwmon_device_register_with_info); | 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 | static char *__hwmon_sanitize_name(struct device *dev, const char *old_name) | 1191 | static char *__hwmon_sanitize_name(struct device *dev, const char *old_name) |
| 1210 | { | 1192 | { |
| 1211 | char *name, *p; | 1193 | char *name, *p; |
| @@ -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 | ||
| 483 | void hwmon_device_unregister(struct device *dev); | 483 | void hwmon_device_unregister(struct device *dev); |
| 484 | void devm_hwmon_device_unregister(struct device *dev); | ||
| 485 | 484 | ||
| 486 | int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type, | 485 | int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type, |
| 487 | u32 attr, int channel); | 486 | u32 attr, int channel); |