From: Thorsten Blum <thorsten.blum@linux.dev>
To: Olivia Mackall <olivia@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
David Laight <david.laight.linux@gmail.com>,
Jonathan McDowell <noodles@meta.com>,
Lianjie Wang <karin0.zst@gmail.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/4] hwrng: core - use bool for wait parameter in rng_get_data
Date: Tue, 5 May 2026 11:45:56 +0200 [thread overview]
Message-ID: <20260505094555.158017-7-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20260505094555.158017-6-thorsten.blum@linux.dev>
The wait parameter in rng_get_data() is a boolean flag - use bool
instead of int to better reflect its actual type.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Formatting changes only as suggested by Andy.
---
drivers/char/hw_random/core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 68add1a97f31..870e77c9ec20 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -210,8 +210,8 @@ static int rng_dev_open(struct inode *inode, struct file *filp)
return 0;
}
-static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
- int wait) {
+static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size, bool wait)
+{
int present;
BUG_ON(!mutex_is_locked(&reading_mutex));
@@ -534,8 +534,7 @@ static int hwrng_fillfn(void *unused)
}
mutex_lock(&reading_mutex);
- rc = rng_get_data(rng, rng_fillbuf,
- rng_buffer_size(), 1);
+ rc = rng_get_data(rng, rng_fillbuf, rng_buffer_size(), true);
if (current_quality != rng->quality)
rng->quality = current_quality; /* obsolete */
quality = rng->quality;
next prev parent reply other threads:[~2026-05-05 9:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 9:45 [PATCH v2 1/4] hwrng: core - drop unnecessary forward declarations Thorsten Blum
2026-05-05 9:45 ` Thorsten Blum [this message]
2026-05-05 9:45 ` [PATCH v2 3/4] hwrng: core - use MAX to simplify RNG_BUFFER_SIZE Thorsten Blum
2026-05-05 9:45 ` [PATCH v2 4/4] hwrng: core - use sysfs_emit_at in rng_available_show Thorsten Blum
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=20260505094555.158017-7-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=david.laight.linux@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=karin0.zst@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=noodles@meta.com \
--cc=olivia@selenic.com \
/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