All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc/nvram: only declare mutex where it's used
@ 2026-05-03  6:46 Simon Richter
  2026-05-03  6:53 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Richter @ 2026-05-03  6:46 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel; +Cc: Simon Richter

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

Signed-off-by: Simon Richter <Simon.Richter@hogyros.de>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] misc/nvram: only declare mutex where it's used
  2026-05-03  6:46 [PATCH] misc/nvram: only declare mutex where it's used Simon Richter
@ 2026-05-03  6:53 ` Greg Kroah-Hartman
  2026-05-03  7:45   ` Simon Richter
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-05-03  6:53 UTC (permalink / raw)
  To: Simon Richter; +Cc: Arnd Bergmann, linux-kernel

On Sun, May 03, 2026 at 03:46:59PM +0900, Simon Richter wrote:
> The ioctls using this are platform specific compatibility code. On other
> platforms, this generates a warning for an unused static variable.
> 
> Signed-off-by: Simon Richter <Simon.Richter@hogyros.de>

What commit id does this fix?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] misc/nvram: only declare mutex where it's used
  2026-05-03  6:53 ` Greg Kroah-Hartman
@ 2026-05-03  7:45   ` Simon Richter
  2026-05-03  7:47     ` [PATCH v2] " Simon Richter
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Richter @ 2026-05-03  7:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Arnd Bergmann, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 644 bytes --]

Hi,

On 5/3/26 15:53, Greg Kroah-Hartman wrote:

> What commit id does this fix?

95ac14b8a3281 "powerpc: Implement nvram ioctls"
20e07af71f34d "powerpc: Adopt nvram module for PPC64"

The former would require

#if defined(CONFIG_PPC) || defined(CONFIG_X86) || defined(CONFIG_M68K)

instead of

#if defined(CONFIG_PPC32) || defined(CONFIG_X86) || defined(CONFIG_M68K)

so documenting the fixes properly would require two commits because 
applying it to 95ac14b8a3281 would break PPC64, so I'd go with 
20e07af71f34d only unless you think I should make an intermediate commit 
that fixes 95ac14b8a3281 as well?

    Simon

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] misc/nvram: only declare mutex where it's used
  2026-05-03  7:45   ` Simon Richter
@ 2026-05-03  7:47     ` Simon Richter
  2026-05-03  8:19       ` Greg Kroah-Hartman
  2026-05-03  8:19       ` Arnd Bergmann
  0 siblings, 2 replies; 7+ messages in thread
From: Simon Richter @ 2026-05-03  7:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arnd Bergmann, linux-kernel; +Cc: Simon Richter

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@hogyros.de>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] misc/nvram: only declare mutex where it's used
  2026-05-03  7:47     ` [PATCH v2] " Simon Richter
@ 2026-05-03  8:19       ` Greg Kroah-Hartman
  2026-05-03  9:15         ` Simon Richter
  2026-05-03  8:19       ` Arnd Bergmann
  1 sibling, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-05-03  8:19 UTC (permalink / raw)
  To: Simon Richter; +Cc: Arnd Bergmann, linux-kernel

On Sun, May 03, 2026 at 04:47:08PM +0900, Simon Richter wrote:
> 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@hogyros.de>
> ---
>  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
> 

Why has no one ever noticed this since 2019?  What changed recently to
cause this warning to show up?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] misc/nvram: only declare mutex where it's used
  2026-05-03  7:47     ` [PATCH v2] " Simon Richter
  2026-05-03  8:19       ` Greg Kroah-Hartman
@ 2026-05-03  8:19       ` Arnd Bergmann
  1 sibling, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2026-05-03  8:19 UTC (permalink / raw)
  To: Simon Richter, Greg Kroah-Hartman, linux-kernel,
	Venkat Rao Bagalkote

On Sun, May 3, 2026, at 09:47, Simon Richter wrote:
> 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@hogyros.de>
> ---
>  drivers/char/nvram.c | 3 +++
>  1 file changed, 3 insertions(+)

I think the better fix is "[PATCH v5] char/nvram: Remove redundant
nvram_mutex", see

https://lore.kernel.org/all/20260428061540.73668-1-venkat88@linux.ibm.com/

      Arnd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] misc/nvram: only declare mutex where it's used
  2026-05-03  8:19       ` Greg Kroah-Hartman
@ 2026-05-03  9:15         ` Simon Richter
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Richter @ 2026-05-03  9:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Arnd Bergmann, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 958 bytes --]

Hi,

On 5/3/26 17:19, Greg Kroah-Hartman wrote:

> Why has no one ever noticed this since 2019?  What changed recently to
> cause this warning to show up?

  - CONFIG_NVRAM depends on X86 || HAVE_ARCH_NVRAM_OPS
  - HAVE_ARCH_NVRAM_OPS is set only on PPC and M68K

so nvram.c is compiled only with CONFIG_X86 || CONFIG_PPC || CONFIG_M68K

  - ppc32 and m68k actually use the mutex

so it shows up only on PPC64 if you build with CONFIG_NVRAM, and is only 
an error if you also build with CONFIG_WERROR as well.

The warning on ppc64 in introduced in 20e07af71f34d, so 95ac14b8a3281 
does not need a fix as the mutex is actually used in all configurations 
where the driver can be enabled.

It's also debatable if the Kconfig is optimal -- HAVE_ARCH_NVRAM_OPS is 
defined in arch/ and used only in this one place, so either x86 should 
set it as well, or it's removed and CONFIG_NVRAM gets an explicit 
architecture list.

    Simon

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-03  9:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03  6:46 [PATCH] misc/nvram: only declare mutex where it's used Simon Richter
2026-05-03  6:53 ` Greg Kroah-Hartman
2026-05-03  7:45   ` Simon Richter
2026-05-03  7:47     ` [PATCH v2] " Simon Richter
2026-05-03  8:19       ` Greg Kroah-Hartman
2026-05-03  9:15         ` Simon Richter
2026-05-03  8:19       ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.