diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2024-03-10 12:00:54 +0100 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2024-04-26 21:29:16 +0200 |
commit | 5bb0b194aeee5d5da6881232f4e9989b35957c25 (patch) | |
tree | 545d0e939ac9060e6cd50e0310dcf56918c30ba6 /drivers/pwm/pwm-stm32.c | |
parent | 4bda9700a55447dfcf33b219de1cf5d7904fdd4f (diff) | |
download | linux-5bb0b194aeee5d5da6881232f4e9989b35957c25.tar.gz linux-5bb0b194aeee5d5da6881232f4e9989b35957c25.tar.bz2 linux-5bb0b194aeee5d5da6881232f4e9989b35957c25.zip |
pwm: sti: Simplify probe function using devm functions
Instead of of_clk_get_by_name() use devm_clk_get_prepared() which has
several advantages:
- Combines getting the clock and a call to clk_prepare(). The latter
can be dropped from sti_pwm_probe() accordingly.
- Cares for calling clk_put() which is missing in both probe's error
path and the remove function.
- Cares for calling clk_unprepare() which can be dropped from the error
paths and the remove function. (Note that not all error path got this
right.)
With additionally using devm_pwmchip_add() instead of pwmchip_add() the
remove callback can be dropped completely. With it the last user of
platform_get_drvdata() goes away and so platform_set_drvdata() can be
dropped from the probe function, too.
Fixes: 378fe115d19d ("pwm: sti: Add new driver for ST's PWM IP")
Link: https://lore.kernel.org/r/81f0e1d173652f435afda6719adaed1922fe059a.1710068192.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/pwm/pwm-stm32.c')
0 files changed, 0 insertions, 0 deletions