Re: [PATCH v1 1/1] sched/fair: Mark some static const with __maybe_unused
From: Arnd Bergmann
Date: Sat Apr 05 2025 - 05:16:54 EST
On Fri, Apr 4, 2025, at 18:52, Andy Shevchenko wrote:
> GCC considers that some static const defined in the lockdep_internals.h
> are unused, which prevents `make W=1` and CONFIG_WERROR=y builds:
>
> kernel/locking/lockdep_internals.h:69:28: error:
> ‘LOCKF_USED_IN_IRQ_READ’ defined but not used
> [-Werror=unused-const-variable=]
> 69 | static const unsigned long LOCKF_USED_IN_IRQ_READ =
> | ^~~~~~~~~~~~~~~~~~~~~~
> kernel/locking/lockdep_internals.h:63:28: error:
> ‘LOCKF_ENABLED_IRQ_READ’ defined but not used
> [-Werror=unused-const-variable=]
> 63 | static const unsigned long LOCKF_ENABLED_IRQ_READ =
> | ^~~~~~~~~~~~~~~~~~~~~~
> kernel/locking/lockdep_internals.h:57:28: error: ‘LOCKF_USED_IN_IRQ’
> defined but not used [-Werror=unused-const-variable=]
> 57 | static const unsigned long LOCKF_USED_IN_IRQ =
> | ^~~~~~~~~~~~~~~~~
> kernel/locking/lockdep_internals.h:51:28: error: ‘LOCKF_ENABLED_IRQ’
> defined but not used [-Werror=unused-const-variable=]
> 51 | static const unsigned long LOCKF_ENABLED_IRQ =
> | ^~~~~~~~~~~~~~~~~
>
> Fix this by marking them with __maybe_unused.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
I posted as different patch for this a while ago:
https://lore.kernel.org/lkml/20250225200830.4031742-1-arnd@xxxxxxxxxx/
Either of the two should be fine here, though I still like my
version a bit better.
Arnd