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.

debugfs: Make debugfs_cancellation a context lock struct

When compiling include/linux/debugfs.h with CONTEXT_ANALYSIS enabled, we
can see this error:

./include/linux/debugfs.h:239:17: error: use of undeclared identifier 'cancellation'
239 | void __acquires(cancellation)

Move the __acquires(..) attribute after the declaration, so that the
compiler can see the cancellation function argument, as well as making
struct debugfs_cancellation a real context lock to benefit from Clang's
context analysis.

This change is a preparatory change to allow enabling context analysis
in subsystems that include the above header.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251219154418.3592607-22-elver@google.com

authored by

Marco Elver and committed by
Peter Zijlstra
6e530e2e 47907461

+5 -7
+5 -7
include/linux/debugfs.h
··· 239 239 * @cancel: callback to call 240 240 * @cancel_data: extra data for the callback to call 241 241 */ 242 - struct debugfs_cancellation { 242 + context_lock_struct(debugfs_cancellation) { 243 243 struct list_head list; 244 244 void (*cancel)(struct dentry *, void *); 245 245 void *cancel_data; 246 246 }; 247 247 248 - void __acquires(cancellation) 249 - debugfs_enter_cancellation(struct file *file, 250 - struct debugfs_cancellation *cancellation); 251 - void __releases(cancellation) 252 - debugfs_leave_cancellation(struct file *file, 253 - struct debugfs_cancellation *cancellation); 248 + void debugfs_enter_cancellation(struct file *file, 249 + struct debugfs_cancellation *cancellation) __acquires(cancellation); 250 + void debugfs_leave_cancellation(struct file *file, 251 + struct debugfs_cancellation *cancellation) __releases(cancellation); 254 252 255 253 #else 256 254