From: Martin Kaiser <martin@kaiser.cx>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Aurelien Jarno <aurelien@aurel32.net>,
Daniel Golle <daniel@makrotopia.org>,
linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Martin Kaiser <martin@kaiser.cx>
Subject: [PATCH 1/2] hwrng: rockchip - rst is used only during probe
Date: Wed, 21 Aug 2024 20:12:34 +0200 [thread overview]
Message-ID: <20240821181235.22270-2-martin@kaiser.cx> (raw)
In-Reply-To: <20240821181235.22270-1-martin@kaiser.cx>
The driver uses the rst variable only for an initial reset when the chip
is probed. There's no need to store rst in the driver's private data, we
can make it a local variable in the probe function.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/char/hw_random/rockchip-rng.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/char/hw_random/rockchip-rng.c b/drivers/char/hw_random/rockchip-rng.c
index 548e2f4d1490..0dff9de64bc5 100644
--- a/drivers/char/hw_random/rockchip-rng.c
+++ b/drivers/char/hw_random/rockchip-rng.c
@@ -52,7 +52,6 @@
struct rk_rng {
struct hwrng rng;
void __iomem *base;
- struct reset_control *rst;
int clk_num;
struct clk_bulk_data *clk_bulks;
};
@@ -132,6 +131,7 @@ static int rk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
static int rk_rng_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct reset_control *rst;
struct rk_rng *rk_rng;
int ret;
@@ -148,14 +148,13 @@ static int rk_rng_probe(struct platform_device *pdev)
return dev_err_probe(dev, rk_rng->clk_num,
"Failed to get clks property\n");
- rk_rng->rst = devm_reset_control_array_get_exclusive(&pdev->dev);
- if (IS_ERR(rk_rng->rst))
- return dev_err_probe(dev, PTR_ERR(rk_rng->rst),
- "Failed to get reset property\n");
+ rst = devm_reset_control_array_get_exclusive(&pdev->dev);
+ if (IS_ERR(rst))
+ return dev_err_probe(dev, PTR_ERR(rst), "Failed to get reset property\n");
- reset_control_assert(rk_rng->rst);
+ reset_control_assert(rst);
udelay(2);
- reset_control_deassert(rk_rng->rst);
+ reset_control_deassert(rst);
platform_set_drvdata(pdev, rk_rng);
--
2.39.2
next prev parent reply other threads:[~2024-08-21 18:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 18:12 [PATCH 0/2] hwrng: rockchip - two simple cleanups Martin Kaiser
2024-08-21 18:12 ` Martin Kaiser [this message]
2024-08-21 18:12 ` [PATCH 2/2] hwrng: rockchip - handle devm_pm_runtime_enable errors Martin Kaiser
2024-08-30 10:38 ` [PATCH 0/2] hwrng: rockchip - two simple cleanups 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=20240821181235.22270-2-martin@kaiser.cx \
--to=martin@kaiser.cx \
--cc=aurelien@aurel32.net \
--cc=daniel@makrotopia.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 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®