diff options
author | Guenter Roeck <linux@roeck-us.net> | 2019-04-18 12:58:20 -0700 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2019-05-14 07:00:47 -0700 |
commit | 37bcec5d9f71bd13142a97d2196b293c9ac23823 (patch) | |
tree | 0350c5a1d8edcee93c0e48b8d204d361d7547300 /include | |
parent | 0b2a785db8797db08181f71395a412c8eedbc614 (diff) |
hwmon: (pwm-fan) Use devm_thermal_of_cooling_device_register
Use devm_thermal_of_cooling_device_register() to register the cooling
device. Also use devm_add_action_or_reset() to stop the fan on device
removal, and to disable the pwm. Introduce a local 'dev' variable in
the probe function to make the code easier to read.
As a side effect, this fixes a bug seen if pwm_fan_of_get_cooling_data()
returned an error. In that situation, the pwm was not disabled, and
the fan was not stopped. Using devm functions also ensures that the
pwm is disabled and that the fan is stopped only after the hwmon device
has been unregistered.
Cc: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions