]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
debugfs: Make debugfs_cancellation a context lock struct
authorMarco Elver <elver@google.com>
Fri, 19 Dec 2025 15:40:10 +0000 (16:40 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 5 Jan 2026 15:43:32 +0000 (16:43 +0100)
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
include/linux/debugfs.h

index 7cecda29447e3f45ed2b8a9ec485fc30af3f57a3..4177c47382826932a88649eb6454379402b89dda 100644 (file)
@@ -239,18 +239,16 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf,
  * @cancel: callback to call
  * @cancel_data: extra data for the callback to call
  */
-struct debugfs_cancellation {
+context_lock_struct(debugfs_cancellation) {
        struct list_head list;
        void (*cancel)(struct dentry *, void *);
        void *cancel_data;
 };
 
-void __acquires(cancellation)
-debugfs_enter_cancellation(struct file *file,
-                          struct debugfs_cancellation *cancellation);
-void __releases(cancellation)
-debugfs_leave_cancellation(struct file *file,
-                          struct debugfs_cancellation *cancellation);
+void debugfs_enter_cancellation(struct file *file,
+                               struct debugfs_cancellation *cancellation) __acquires(cancellation);
+void debugfs_leave_cancellation(struct file *file,
+                               struct debugfs_cancellation *cancellation) __releases(cancellation);
 
 #else