Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

printk: Move locking annotation to printk.c

With Sparse support gone, Clang is a bit more strict and warns:

./include/linux/console.h:492:50: error: use of undeclared identifier 'console_mutex'
492 | extern void console_list_unlock(void) __releases(console_mutex);

Since it does not make sense to make console_mutex itself global, move
the annotation to printk.c. Context analysis remains disabled for
printk.c.

This is needed to enable context analysis for modules that include
<linux/console.h>.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251219154418.3592607-34-elver@google.com

authored by

Marco Elver and committed by
Peter Zijlstra
8ec56d9a 322366b8

+4 -2
+2 -2
include/linux/console.h
··· 492 492 extern int console_srcu_read_lock(void); 493 493 extern void console_srcu_read_unlock(int cookie); 494 494 495 - extern void console_list_lock(void) __acquires(console_mutex); 496 - extern void console_list_unlock(void) __releases(console_mutex); 495 + extern void console_list_lock(void); 496 + extern void console_list_unlock(void); 497 497 498 498 extern struct hlist_head console_list; 499 499
+2
kernel/printk/printk.c
··· 245 245 * For console list or console->flags updates 246 246 */ 247 247 void console_list_lock(void) 248 + __acquires(&console_mutex) 248 249 { 249 250 /* 250 251 * In unregister_console() and console_force_preferred_locked(), ··· 270 269 * Counterpart to console_list_lock() 271 270 */ 272 271 void console_list_unlock(void) 272 + __releases(&console_mutex) 273 273 { 274 274 mutex_unlock(&console_mutex); 275 275 }