From: Guenter Roeck Date: Thu, 18 Apr 2019 19:58:16 +0000 (-0700) Subject: hwmon: (aspeed-pwm-tacho) Use devm_thermal_of_cooling_device_register X-Git-Tag: v5.4-rc1~970^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=389c0ad1d61ec5790174ecb0f01eac13423a18e1;p=platform%2Fkernel%2Flinux-rpi.git 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 Cc: Joel Stanley Signed-off-by: Guenter Roeck Reviewed-by: Patrick Venture Signed-off-by: Eduardo Valentin --- diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index c4dd630..0daf0b3 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, } snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port); - cdev->tcdev = thermal_of_cooling_device_register(child, - cdev->name, - cdev, - &aspeed_pwm_cool_ops); + cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child, + cdev->name, cdev, &aspeed_pwm_cool_ops); if (IS_ERR(cdev->tcdev)) return PTR_ERR(cdev->tcdev);