* [PATCH] hwrng: stm32 - use swap() in stm32_rng_probe()
@ 2026-10-01 21:04 Thorsten Blum
2026-10-02 7:40 ` Maxime MERE
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-10-01 21:04 UTC (permalink / raw)
To: Olivia Mackall, Herbert Xu, Maxime Coquelin, Alexandre Torgue,
Can Peng, Linus Walleij
Cc: Thorsten Blum, linux-crypto, linux-stm32, linux-arm-kernel, linux-kernel
Use swap() to simplify stm32_rng_probe().
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/char/hw_random/stm32-rng.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index d3fc910f674a..b13361dcad12 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -569,18 +569,11 @@ static int stm32_rng_probe(struct platform_device *ofdev)
return dev_err_probe(dev, -EINVAL, "Failed to get clocks: %d\n", ret);
if (priv->data->nb_clock == 2) {
- const char *id = priv->clk_bulk[1].id;
- struct clk *clk = priv->clk_bulk[1].clk;
-
if (!priv->clk_bulk[0].id || !priv->clk_bulk[1].id)
return dev_err_probe(dev, -EINVAL, "Missing clock name\n");
- if (strcmp(priv->clk_bulk[0].id, "core")) {
- priv->clk_bulk[1].id = priv->clk_bulk[0].id;
- priv->clk_bulk[1].clk = priv->clk_bulk[0].clk;
- priv->clk_bulk[0].id = id;
- priv->clk_bulk[0].clk = clk;
- }
+ if (strcmp(priv->clk_bulk[0].id, "core"))
+ swap(priv->clk_bulk[0], priv->clk_bulk[1]);
}
pm_runtime_set_autosuspend_delay(dev, 100);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] hwrng: stm32 - use swap() in stm32_rng_probe()
2026-10-01 21:04 [PATCH] hwrng: stm32 - use swap() in stm32_rng_probe() Thorsten Blum
@ 2026-10-02 7:40 ` Maxime MERE
0 siblings, 0 replies; 2+ messages in thread
From: Maxime MERE @ 2026-10-02 7:40 UTC (permalink / raw)
To: Thorsten Blum, Olivia Mackall, Herbert Xu, Maxime Coquelin,
Alexandre Torgue, Can Peng, Linus Walleij
Cc: linux-crypto, linux-stm32, linux-arm-kernel, linux-kernel
Acked-by: Maxime Méré <maxime.mere@foss.st.com>
On 10/1/26 23:04, Thorsten Blum wrote:
> Use swap() to simplify stm32_rng_probe().
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> ---
> drivers/char/hw_random/stm32-rng.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
> index d3fc910f674a..b13361dcad12 100644
> --- a/drivers/char/hw_random/stm32-rng.c
> +++ b/drivers/char/hw_random/stm32-rng.c
> @@ -569,18 +569,11 @@ static int stm32_rng_probe(struct platform_device *ofdev)
> return dev_err_probe(dev, -EINVAL, "Failed to get clocks: %d\n", ret);
>
> if (priv->data->nb_clock == 2) {
> - const char *id = priv->clk_bulk[1].id;
> - struct clk *clk = priv->clk_bulk[1].clk;
> -
> if (!priv->clk_bulk[0].id || !priv->clk_bulk[1].id)
> return dev_err_probe(dev, -EINVAL, "Missing clock name\n");
>
> - if (strcmp(priv->clk_bulk[0].id, "core")) {
> - priv->clk_bulk[1].id = priv->clk_bulk[0].id;
> - priv->clk_bulk[1].clk = priv->clk_bulk[0].clk;
> - priv->clk_bulk[0].id = id;
> - priv->clk_bulk[0].clk = clk;
> - }
> + if (strcmp(priv->clk_bulk[0].id, "core"))
> + swap(priv->clk_bulk[0], priv->clk_bulk[1]);
> }
>
> pm_runtime_set_autosuspend_delay(dev, 100);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-02 7:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 21:04 [PATCH] hwrng: stm32 - use swap() in stm32_rng_probe() Thorsten Blum
2026-10-02 7:40 ` Maxime MERE
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®