All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] lockdep: Mark chain_hlock_class_idx() with __maybe_unused
@ 2024-12-09 17:08 Andy Shevchenko
  2024-12-15 19:55 ` Boqun Feng
  2024-12-24 18:53 ` [tip: locking/core] " tip-bot2 for Andy Shevchenko
  0 siblings, 2 replies; 8+ messages in thread
From: Andy Shevchenko @ 2024-12-09 17:08 UTC (permalink / raw)
  To: linux-kernel, llvm
  Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Waiman Long, Boqun Feng,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Andy Shevchenko

When chain_hlock_class_idx() is unused, it prevents kernel builds with clang,
`make W=1` and CONFIG_WERROR=y:

kernel/locking/lockdep.c:435:28: error: unused function 'chain_hlock_class_idx' [-Werror,-Wunused-function]

Fix this by marking it with __maybe_unused.

See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
inline functions for W=1 build").

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kernel/locking/lockdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index bb65abfcfa71..29acd238dad7 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -432,7 +432,7 @@ static inline u16 hlock_id(struct held_lock *hlock)
 	return (hlock->class_idx | (hlock->read << MAX_LOCKDEP_KEYS_BITS));
 }
 
-static inline unsigned int chain_hlock_class_idx(u16 hlock_id)
+static inline __maybe_unused unsigned int chain_hlock_class_idx(u16 hlock_id)
 {
 	return hlock_id & (MAX_LOCKDEP_KEYS - 1);
 }
-- 
2.43.0.rc1.1336.g36b5255a03ac


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

end of thread, other threads:[~2025-01-20 17:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 17:08 [PATCH v1 1/1] lockdep: Mark chain_hlock_class_idx() with __maybe_unused Andy Shevchenko
2024-12-15 19:55 ` Boqun Feng
2024-12-15 21:21   ` Andy Shevchenko
2024-12-19 21:57     ` Boqun Feng
2024-12-23 18:55       ` Andy Shevchenko
2025-01-20  8:11       ` Ingo Molnar
2025-01-20 17:00         ` Boqun Feng
2024-12-24 18:53 ` [tip: locking/core] " tip-bot2 for Andy Shevchenko

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.