diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2019-04-18 15:58:16 -0400 |
|---|---|---|
| committer | Eduardo Valentin <edubezval@gmail.com> | 2019-05-14 10:00:44 -0400 |
| commit | 389c0ad1d61ec5790174ecb0f01eac13423a18e1 (patch) | |
| tree | 11e6ad708c4ec5164ca4d72b730960786ebaf5b8 | |
| parent | e380ea8117ce8c83c5da7063a3587a728132de0b (diff) | |
hwmon: (aspeed-pwm-tacho) Use devm_thermal_of_cooling_device_register
Use devm_thermal_of_cooling_device_register() to register the cooling
device. As a side effect, this fixes a driver bug:
thermal_cooling_device_unregister() was not called on removal.
Fixes: f198907d2ff6d ("hwmon: (aspeed-pwm-tacho) cooling device support.")
Cc: Mykola Kostenok <c_mykolak@mellanox.com>
Cc: Joel Stanley <joel@jms.id.au>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Patrick Venture <venture@google.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
| -rw-r--r-- | drivers/hwmon/aspeed-pwm-tacho.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index c4dd6301e7c8..0daf0b32aa4a 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c | |||
| @@ -830,10 +830,8 @@ static int aspeed_create_pwm_cooling(struct device *dev, | |||
| 830 | } | 830 | } |
| 831 | snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port); | 831 | snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port); |
| 832 | 832 | ||
| 833 | cdev->tcdev = thermal_of_cooling_device_register(child, | 833 | cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child, |
| 834 | cdev->name, | 834 | cdev->name, cdev, &aspeed_pwm_cool_ops); |
| 835 | cdev, | ||
| 836 | &aspeed_pwm_cool_ops); | ||
| 837 | if (IS_ERR(cdev->tcdev)) | 835 | if (IS_ERR(cdev->tcdev)) |
| 838 | return PTR_ERR(cdev->tcdev); | 836 | return PTR_ERR(cdev->tcdev); |
| 839 | 837 | ||
