]> git.baikalelectronics.ru Git - kernel.git/commit
hwmon: (pwm-fan) stop using legacy PWM functions and some cleanups
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 12 Jan 2021 19:13:14 +0000 (20:13 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 28 Jan 2021 01:44:19 +0000 (17:44 -0800)
commita2f496c3fc23cbfa53f01d34b035542ba7bf489b
treea7d396e586f7382fec9ed38cbb4bcd684bcbb7f1
parentf079c94947b35fc07decd9f00c3fdc9805db3b02
hwmon: (pwm-fan) stop using legacy PWM functions and some cleanups

pwm_apply_state() does what the legacy functions pwm_config() and
pwm_{en,dis}able() do in a single function call. This simplifies error
handling and is more efficient for new-style PWM hardware drivers.

Instead of repeatedly querying the PWM framework about the initial PWM
configuration, cache the settings in driver data.

Also use __set_pwm() in .probe() to have the algorithm calculating the PWM
state in a single place.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210112191314.124686-1-u.kleine-koenig@pengutronix.de
[groeck: Added missing empty line after declaration]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pwm-fan.c