[PATCH] nvram: Only define nvram_mutex where it is used
From: Mukesh Kumar Chaurasiya (IBM)
Date: Mon May 25 2026 - 04:04:50 EST
nvram_mutex is currently defined unconditionally, but is only used on
x86, ppc32 and m68k. This causes an unused symbol warning on other
architectures.
Restrict the mutex definition to the architectures that actually require
it and avoid generating unnecessary warnings on the remaining platforms.
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@xxxxxxxxx>
---
drivers/char/nvram.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 9eff426a9286..72ddb225a2ba 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -53,7 +53,10 @@
#include <asm/nvram.h>
#endif
+#if IS_ENABLED(CONFIG_PPC32) || IS_ENABLED(CONFIG_X86) || IS_ENABLED(CONFIG_M68K)
static DEFINE_MUTEX(nvram_mutex);
+#endif
+
static DEFINE_SPINLOCK(nvram_state_lock);
static int nvram_open_cnt; /* #times opened */
static int nvram_open_mode; /* special open modes */
--
2.54.0