* [PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
@ 2026-03-23 7:24 Venkat Rao Bagalkote
2026-03-23 7:35 ` Venkat Rao Bagalkote
2026-03-23 7:36 ` Greg KH
0 siblings, 2 replies; 4+ messages in thread
From: Venkat Rao Bagalkote @ 2026-03-23 7:24 UTC (permalink / raw)
To: arnd, gregkh
Cc: linux-kernel, linux-kbuild, linuxppc-dev, nathan, nsc, ojeda,
masahiroy, linux, tamird, rostedt, ihor.solodrai, ritesh.list,
maddy, peterz, venkat88
drivers/char/nvram.c defines a static mutex 'nvram_mutex' which is never
used. This results in a compiler warning on linux-next builds:
warning: 'nvram_mutex' defined but not used [-Wunused-variable]
Remove the unused definition to avoid the warning.
Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
---
drivers/char/nvram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 9eff426a9286..2ce3307663ed 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -53,7 +53,7 @@
#include <asm/nvram.h>
#endif
-static DEFINE_MUTEX(nvram_mutex);
+static __maybe_unused DEFINE_MUTEX(nvram_mutex);
static DEFINE_SPINLOCK(nvram_state_lock);
static int nvram_open_cnt; /* #times opened */
static int nvram_open_mode; /* special open modes */
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
2026-03-23 7:24 [PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning Venkat Rao Bagalkote
@ 2026-03-23 7:35 ` Venkat Rao Bagalkote
2026-03-23 7:36 ` Greg KH
1 sibling, 0 replies; 4+ messages in thread
From: Venkat Rao Bagalkote @ 2026-03-23 7:35 UTC (permalink / raw)
To: arnd, gregkh
Cc: linux-kernel, linux-kbuild, linuxppc-dev, nathan, nsc, ojeda,
masahiroy, linux, tamird, rostedt, ihor.solodrai, ritesh.list,
maddy, peterz
Please ignore this. Sent v2 [1]
[1]:
https://lore.kernel.org/all/20260323073220.25798-1-venkat88@linux.ibm.com/
Regards,
Venkat.
On 23/03/26 12:54 pm, Venkat Rao Bagalkote wrote:
> drivers/char/nvram.c defines a static mutex 'nvram_mutex' which is never
> used. This results in a compiler warning on linux-next builds:
>
> warning: 'nvram_mutex' defined but not used [-Wunused-variable]
>
> Remove the unused definition to avoid the warning.
>
> Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> ---
> drivers/char/nvram.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
> index 9eff426a9286..2ce3307663ed 100644
> --- a/drivers/char/nvram.c
> +++ b/drivers/char/nvram.c
> @@ -53,7 +53,7 @@
> #include <asm/nvram.h>
> #endif
>
> -static DEFINE_MUTEX(nvram_mutex);
> +static __maybe_unused DEFINE_MUTEX(nvram_mutex);
> static DEFINE_SPINLOCK(nvram_state_lock);
> static int nvram_open_cnt; /* #times opened */
> static int nvram_open_mode; /* special open modes */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
2026-03-23 7:24 [PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning Venkat Rao Bagalkote
2026-03-23 7:35 ` Venkat Rao Bagalkote
@ 2026-03-23 7:36 ` Greg KH
2026-03-23 7:59 ` Arnd Bergmann
1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2026-03-23 7:36 UTC (permalink / raw)
To: Venkat Rao Bagalkote
Cc: arnd, linux-kernel, linux-kbuild, linuxppc-dev, nathan, nsc,
ojeda, masahiroy, linux, tamird, rostedt, ihor.solodrai,
ritesh.list, maddy, peterz
On Mon, Mar 23, 2026 at 12:54:22PM +0530, Venkat Rao Bagalkote wrote:
> drivers/char/nvram.c defines a static mutex 'nvram_mutex' which is never
> used. This results in a compiler warning on linux-next builds:
>
> warning: 'nvram_mutex' defined but not used [-Wunused-variable]
>
> Remove the unused definition to avoid the warning.
>
> Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> ---
> drivers/char/nvram.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
> index 9eff426a9286..2ce3307663ed 100644
> --- a/drivers/char/nvram.c
> +++ b/drivers/char/nvram.c
> @@ -53,7 +53,7 @@
> #include <asm/nvram.h>
> #endif
>
> -static DEFINE_MUTEX(nvram_mutex);
> +static __maybe_unused DEFINE_MUTEX(nvram_mutex);
If it is never used, why not actually delete it? This just papers over
the real issue :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning
2026-03-23 7:36 ` Greg KH
@ 2026-03-23 7:59 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-03-23 7:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Venkat Rao Bagalkote
Cc: linux-kernel, linux-kbuild, linuxppc-dev, Nathan Chancellor,
Nicolas Schier, Miguel Ojeda, Masahiro Yamada,
Thomas Weißschuh, tamird, Steven Rostedt, ihor.solodrai,
Ritesh Harjani (IBM), Madhavan Srinivasan, Peter Zijlstra
On Mon, Mar 23, 2026, at 08:36, Greg KH wrote:
> On Mon, Mar 23, 2026 at 12:54:22PM +0530, Venkat Rao Bagalkote wrote:
>> drivers/char/nvram.c defines a static mutex 'nvram_mutex' which is never
>> used. This results in a compiler warning on linux-next builds:
>>
>> warning: 'nvram_mutex' defined but not used [-Wunused-variable]
>>
>> Remove the unused definition to avoid the warning.
>>
>> Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
>> ---
>> drivers/char/nvram.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
>> index 9eff426a9286..2ce3307663ed 100644
>> --- a/drivers/char/nvram.c
>> +++ b/drivers/char/nvram.c
>> @@ -53,7 +53,7 @@
>> #include <asm/nvram.h>
>> #endif
>>
>> -static DEFINE_MUTEX(nvram_mutex);
>> +static __maybe_unused DEFINE_MUTEX(nvram_mutex);
>
> If it is never used, why not actually delete it? This just papers over
> the real issue :(
It's used on ppc32, atari and x86, but not ppc64.
However, I see that all the implementations that have the
mutex in their code path also have an inner spinlock that
does the same thing, while the mutex is a renmant from my
613655fa39ff ("drivers: autoconvert trivial BKL users to
private mutex").
I'm fairly sure we can actually remove it.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-23 8:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 7:24 [PATCH] char: nvram: Remove unused nvram_mutex to fix -Wunused-variable warning Venkat Rao Bagalkote
2026-03-23 7:35 ` Venkat Rao Bagalkote
2026-03-23 7:36 ` Greg KH
2026-03-23 7:59 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox