* [PATCH] serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe()
@ 2026-11-19 17:12 Markus Elfring
2026-11-19 17:36 ` Hugo Villeneuve
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2026-11-19 17:12 UTC (permalink / raw)
To: linux-serial, Greg Kroah-Hartman, Hugo Villeneuve, Jiri Slaby,
Joachim Knorr, Luca Fresi, Martin Fuzzey, Paul Mbewe,
Uwe Kleine-König
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 19 Nov 2026 18:04:56 +0100
Reuse existing functionality from devm_clk_get_optional_enabled()
instead of keeping duplicate source code.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/tty/serial/sc16is7xx.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index dbf38825a78c..3af8ea93b34a 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1605,14 +1605,10 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
dev_dbg(dev,
"No interrupt pin definition, falling back to polling mode\n");
- s->clk = devm_clk_get_optional(dev, NULL);
+ s->clk = devm_clk_get_optional_enabled(dev, NULL);
if (IS_ERR(s->clk))
return PTR_ERR(s->clk);
- ret = clk_prepare_enable(s->clk);
- if (ret)
- return ret;
-
freq = clk_get_rate(s->clk);
if (freq == 0) {
if (uartclk)
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe()
2026-11-19 17:12 [PATCH] serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe() Markus Elfring
@ 2026-11-19 17:36 ` Hugo Villeneuve
2026-11-19 17:43 ` Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Hugo Villeneuve @ 2026-11-19 17:36 UTC (permalink / raw)
To: Markus Elfring
Cc: linux-serial, Greg Kroah-Hartman, Hugo Villeneuve, Jiri Slaby,
Joachim Knorr, Luca Fresi, Martin Fuzzey, Paul Mbewe,
Uwe Kleine-König, LKML, kernel-janitors
Hi Markus,
On Thu, 19 Nov 2026 18:12:33 +0100
Markus Elfring <Markus.Elfring@web.de> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 19 Nov 2026 18:04:56 +0100
>
> Reuse existing functionality from devm_clk_get_optional_enabled()
> instead of keeping duplicate source code.
>
> The source code was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/tty/serial/sc16is7xx.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index dbf38825a78c..3af8ea93b34a 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -1605,14 +1605,10 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
> dev_dbg(dev,
> "No interrupt pin definition, falling back to polling mode\n");
>
> - s->clk = devm_clk_get_optional(dev, NULL);
> + s->clk = devm_clk_get_optional_enabled(dev, NULL);
> if (IS_ERR(s->clk))
> return PTR_ERR(s->clk);
>
> - ret = clk_prepare_enable(s->clk);
> - if (ret)
> - return ret;
> -
> freq = clk_get_rate(s->clk);
> if (freq == 0) {
> if (uartclk)
Nak, your patch is incomplete and in fact just duplicates, in part,
what Xiangwu's patch does:
https://lore.kernel.org/all/20261113103855.2144-1-laixiangwu@cmss.chinamobile.com/
--
Hugo Villeneuve
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe()
2026-11-19 17:36 ` Hugo Villeneuve
@ 2026-11-19 17:43 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-11-19 17:43 UTC (permalink / raw)
To: Hugo Villeneuve, linux-serial
Cc: Greg Kroah-Hartman, Hugo Villeneuve, Jiri Slaby, Joachim Knorr,
Luca Fresi, Martin Fuzzey, Paul Mbewe, Uwe Kleine-König,
Xiangwu Lai, LKML, kernel-janitors
> Nak, your patch is incomplete and in fact just duplicates, in part,
> what Xiangwu's patch does:
>
> https://lore.kernel.org/all/20261113103855.2144-1-laixiangwu@cmss.chinamobile.com/
Thanks that you point another contribution out.
[PATCH v2] serial: sc16is7xx: Fix clock leak on invalid clock frequency
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-19 17:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 17:12 [PATCH] serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe() Markus Elfring
2026-11-19 17:36 ` Hugo Villeneuve
2026-11-19 17:43 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®