[PATCH v2] misc/nvram: only declare mutex where it's used

From: Simon Richter

Date: Sun May 03 2026 - 03:49:42 EST


The ioctls using this are platform specific compatibility code. On other
platforms, this generates a warning for an unused static variable.

Fixes: 20e07af71f34d ("powerpc: Adopt nvram module for PPC64")
Signed-off-by: Simon Richter <Simon.Richter@xxxxxxxxxx>
---
drivers/char/nvram.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 9eff426a9286..34bbeba073fe 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -53,7 +53,10 @@
#include <asm/nvram.h>
#endif

+#if defined(CONFIG_PPC32) || defined(CONFIG_X86) || defined(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.47.3