diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-12-30 17:59:56 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-19 15:51:28 +0100 |
commit | 03e30f06e5286bc91ba4785d33c1d3fa03e8a442 (patch) | |
tree | 9ff2b2f1009f84732ab2ced846c029aa094e8baa /drivers | |
parent | serial: ucc_uart: Add of_node_put() in ucc_uart_remove() (diff) | |
download | linux-03e30f06e5286bc91ba4785d33c1d3fa03e8a442.tar.xz linux-03e30f06e5286bc91ba4785d33c1d3fa03e8a442.zip |
serial: sccnxp: Use devm_clk_get_enabled() helper
The devm_clk_get_enabled() helper:
- calls devm_clk_get()
- calls clk_prepare_enable() and registers what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code.
This also avoids some other warnings/issues. (see [1])
[1]: https://lore.kernel.org/all/20221118233101.never.215-kees@kernel.org/
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/735a807c2df835aa436dcbc76b374f983f89a9af.1672419577.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/sccnxp.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index 7df687822634..4f2fc5f7bb19 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c @@ -913,23 +913,13 @@ static int sccnxp_probe(struct platform_device *pdev) } else if (PTR_ERR(s->regulator) == -EPROBE_DEFER) return -EPROBE_DEFER; - clk = devm_clk_get(&pdev->dev, NULL); + clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(clk)) { ret = PTR_ERR(clk); if (ret == -EPROBE_DEFER) goto err_out; uartclk = 0; } else { - ret = clk_prepare_enable(clk); - if (ret) - goto err_out; - - ret = devm_add_action_or_reset(&pdev->dev, - (void(*)(void *))clk_disable_unprepare, - clk); - if (ret) - goto err_out; - uartclk = clk_get_rate(clk); } |