From: Thorsten Blum <thorsten.blum@linux.dev>
To: Olivia Mackall <olivia@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Thorsten Blum <thorsten.blum@linux.dev>
Subject: [PATCH 3/4] hwrng: core - use MAX to simplify RNG_BUFFER_SIZE
Date: Thu, 30 Apr 2026 13:00:50 +0200 [thread overview]
Message-ID: <20260430110047.248825-7-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20260430110047.248825-5-thorsten.blum@linux.dev>
Replace the open-coded variant with MAX().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/char/hw_random/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 905a63525831..f8f7a2ee73c1 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -17,6 +17,7 @@
#include <linux/hw_random.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
+#include <linux/minmax.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/random.h>
@@ -30,7 +31,7 @@
#define RNG_MODULE_NAME "hw_random"
-#define RNG_BUFFER_SIZE (SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES)
+#define RNG_BUFFER_SIZE MAX(32, SMP_CACHE_BYTES)
static struct hwrng __rcu *current_rng;
/* the current rng has been explicitly chosen by user via sysfs */
next prev parent reply other threads:[~2026-04-30 11:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 11:00 [PATCH 1/4] hwrng: core - drop unnecessary forward declarations Thorsten Blum
2026-04-30 11:00 ` [PATCH 2/4] hwrng: core - use bool for wait parameter in rng_get_data Thorsten Blum
2026-05-04 13:54 ` Andy Shevchenko
2026-05-04 14:37 ` Thorsten Blum
2026-05-04 14:44 ` Andy Shevchenko
2026-04-30 11:00 ` Thorsten Blum [this message]
2026-05-04 13:56 ` [PATCH 3/4] hwrng: core - use MAX to simplify RNG_BUFFER_SIZE Andy Shevchenko
2026-05-05 5:33 ` Herbert Xu
2026-04-30 11:00 ` [PATCH 4/4] hwrng: core - use sysfs_emit_at in rng_available_show Thorsten Blum
2026-05-04 13:58 ` Andy Shevchenko
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=20260430110047.248825-7-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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