All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Olivia Mackall <olivia@selenic.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Can Peng <pengcan@kylinos.cn>, Linus Walleij <linusw@kernel.org>
Cc: Thorsten Blum <blum@kernel.org>,
	linux-crypto@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] hwrng: stm32 - use swap() in stm32_rng_probe()
Date: Thu,  1 Oct 2026 23:04:48 +0200	[thread overview]
Message-ID: <20261001210450.37467-2-blum@kernel.org> (raw)

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);

             reply	other threads:[~2026-10-01 21:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 21:04 Thorsten Blum [this message]
2026-10-02  7:40 ` [PATCH] hwrng: stm32 - use swap() in stm32_rng_probe() Maxime MERE
2026-10-08  8:31 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261001210450.37467-2-blum@kernel.org \
    --to=blum@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=olivia@selenic.com \
    --cc=pengcan@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.