[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20260114-vdso-header-cleanups-v1-15-803b80ee97b4@linutronix.de>
Date: Wed, 14 Jan 2026 09:01:47 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Russell King <linux@...linux.org.uk>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
"Christophe Leroy (CS GROUP)" <chleroy@...nel.org>,
Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Andy Lutomirski <luto@...nel.org>, Thomas Gleixner <tglx@...nel.org>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Theodore Ts'o <tytso@....edu>, "Jason A. Donenfeld" <Jason@...c4.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, loongarch@...ts.linux.dev,
linux-mips@...r.kernel.org,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Subject: [PATCH 15/15] random: vDSO: remove ifdeffery
Recent cleanups of the vDSO headers allow the unconditional inclusion of
vdso/datapage.h and the declarations it provides. This also means that
the declaration of vdso_k_rng_data is always visible and its usage does
not need to be guarded by ifdefs anymore. Instead use IS_ENABLED().
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
---
drivers/char/random.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index c5122ff33594..64f709fdf434 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -56,9 +56,7 @@
#include <linux/sched/isolation.h>
#include <crypto/chacha.h>
#include <crypto/blake2s.h>
-#ifdef CONFIG_VDSO_GETRANDOM
#include <vdso/datapage.h>
-#endif
#include <asm/archrandom.h>
#include <asm/processor.h>
#include <asm/irq.h>
@@ -274,7 +272,7 @@ static void crng_reseed(struct work_struct *work)
if (next_gen == ULONG_MAX)
++next_gen;
WRITE_ONCE(base_crng.generation, next_gen);
-#ifdef CONFIG_VDSO_GETRANDOM
+
/* base_crng.generation's invalid value is ULONG_MAX, while
* vdso_k_rng_data->generation's invalid value is 0, so add one to the
* former to arrive at the latter. Use smp_store_release so that this
@@ -288,8 +286,9 @@ static void crng_reseed(struct work_struct *work)
* because the vDSO side only checks whether the value changed, without
* actually using or interpreting the value.
*/
- smp_store_release((unsigned long *)&vdso_k_rng_data->generation, next_gen + 1);
-#endif
+ if (IS_ENABLED(CONFIG_VDSO_GETRANDOM))
+ smp_store_release((unsigned long *)&vdso_k_rng_data->generation, next_gen + 1);
+
if (!static_branch_likely(&crng_is_ready))
crng_init = CRNG_READY;
spin_unlock_irqrestore(&base_crng.lock, flags);
@@ -742,9 +741,8 @@ static void __cold _credit_init_bits(size_t bits)
if (system_dfl_wq)
queue_work(system_dfl_wq, &set_ready);
atomic_notifier_call_chain(&random_ready_notifier, 0, NULL);
-#ifdef CONFIG_VDSO_GETRANDOM
- WRITE_ONCE(vdso_k_rng_data->is_ready, true);
-#endif
+ if (IS_ENABLED(CONFIG_VDSO_GETRANDOM))
+ WRITE_ONCE(vdso_k_rng_data->is_ready, true);
wake_up_interruptible(&crng_init_wait);
kill_fasync(&fasync, SIGIO, POLL_IN);
pr_notice("crng init done\n");
--
2.52.0
Powered by blists - more mailing lists