Merge branch 'pcmcia' of git://git.armlinux.org.uk/~rmk/linux-arm
[cascardo/linux.git] / include / linux / debugfs.h
index 1438e23..4d3f0d1 100644 (file)
@@ -45,6 +45,23 @@ extern struct dentry *arch_debugfs_dir;
 
 extern struct srcu_struct debugfs_srcu;
 
+/**
+ * debugfs_real_fops - getter for the real file operation
+ * @filp: a pointer to a struct file
+ *
+ * Must only be called under the protection established by
+ * debugfs_use_file_start().
+ */
+static inline const struct file_operations *debugfs_real_fops(struct file *filp)
+       __must_hold(&debugfs_srcu)
+{
+       /*
+        * Neither the pointer to the struct file_operations, nor its
+        * contents ever change -- srcu_dereference() is not needed here.
+        */
+       return filp->f_path.dentry->d_fsdata;
+}
+
 #if defined(CONFIG_DEBUG_FS)
 
 struct dentry *debugfs_create_file(const char *name, umode_t mode,