summaryrefslogtreecommitdiffstats
path: root/drivers/edac/debugfs.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2015-09-22 12:16:05 +0200
committerBorislav Petkov <bp@suse.de>2015-09-22 18:10:22 +0200
commit4397bcb4fa1dd285a2c6d583d1f1cbc6bd423f97 (patch)
treed215da1571321864e4fcb082c1d28820a1bc8dd9 /drivers/edac/debugfs.c
parentEDAC: Carve out debugfs functionality (diff)
downloadlinux-4397bcb4fa1dd285a2c6d583d1f1cbc6bd423f97.tar.xz
linux-4397bcb4fa1dd285a2c6d583d1f1cbc6bd423f97.zip
EDAC: Add debugfs wrappers
Later patches will convert EDAC users to those. Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac/debugfs.c')
-rw-r--r--drivers/edac/debugfs.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/edac/debugfs.c b/drivers/edac/debugfs.c
index bcd558d5cb48..4864703115cc 100644
--- a/drivers/edac/debugfs.c
+++ b/drivers/edac/debugfs.c
@@ -101,3 +101,63 @@ nomem:
debugfs_remove(mci->debugfs);
return -ENOMEM;
}
+
+/* Create a toplevel dir under EDAC's debugfs hierarchy */
+struct dentry *edac_debugfs_create_dir(const char *dirname)
+{
+ if (!edac_debugfs)
+ return NULL;
+
+ return debugfs_create_dir(dirname, edac_debugfs);
+}
+EXPORT_SYMBOL_GPL(edac_debugfs_create_dir);
+
+/* Create a toplevel dir under EDAC's debugfs hierarchy with parent @parent */
+struct dentry *
+edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent)
+{
+ return debugfs_create_dir(dirname, parent);
+}
+EXPORT_SYMBOL_GPL(edac_debugfs_create_dir_at);
+
+/*
+ * Create a file under EDAC's hierarchy or a sub-hierarchy:
+ *
+ * @name: file name
+ * @mode: file permissions
+ * @parent: parent dentry. If NULL, it becomes the toplevel EDAC dir
+ * @data: private data of caller
+ * @fops: file operations of this file
+ */
+struct dentry *
+edac_debugfs_create_file(const char *name, umode_t mode, struct dentry *parent,
+ void *data, const struct file_operations *fops)
+{
+ if (!parent)
+ parent = edac_debugfs;
+
+ return debugfs_create_file(name, mode, parent, data, fops);
+}
+EXPORT_SYMBOL_GPL(edac_debugfs_create_file);
+
+/* Wrapper for debugfs_create_x8() */
+struct dentry *edac_debugfs_create_x8(const char *name, umode_t mode,
+ struct dentry *parent, u8 *value)
+{
+ if (!parent)
+ parent = edac_debugfs;
+
+ return debugfs_create_x8(name, mode, parent, value);
+}
+EXPORT_SYMBOL_GPL(edac_debugfs_create_x8);
+
+/* Wrapper for debugfs_create_x16() */
+struct dentry *edac_debugfs_create_x16(const char *name, umode_t mode,
+ struct dentry *parent, u16 *value)
+{
+ if (!parent)
+ parent = edac_debugfs;
+
+ return debugfs_create_x16(name, mode, parent, value);
+}
+EXPORT_SYMBOL_GPL(edac_debugfs_create_x16);