summaryrefslogtreecommitdiff
path: root/drivers/edac/edac_mc_sysfs.c
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-06-12 06:32:12 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-12 19:15:49 +0400
commite7930ba49e469d9ce7374a788336caf955f8d7e2 (patch)
treee022c408057f46881d8da9cfd9b76d5b34e551d5 /drivers/edac/edac_mc_sysfs.c
parentc10538396bf3f0076630103ede49c863c27db720 (diff)
downloadlinux-e7930ba49e469d9ce7374a788336caf955f8d7e2.tar.xz
edac: create top-level debugfs directory
Create a single, top-level "edac" directory for debugfs. An "mc[0-N]" directory is then created for each memory controller. Individual drivers can create additional entries such as h/w error injection control. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac/edac_mc_sysfs.c')
-rw-r--r--drivers/edac/edac_mc_sysfs.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 55b2f0a18d22..a2bf7e9dd6de 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -899,13 +899,33 @@ static struct device_type mci_attr_type = {
};
#ifdef CONFIG_EDAC_DEBUG
+static struct dentry *edac_debugfs;
+
+int __init edac_debugfs_init(void)
+{
+ edac_debugfs = debugfs_create_dir("edac", NULL);
+ if (IS_ERR(edac_debugfs)) {
+ edac_debugfs = NULL;
+ return -ENOMEM;
+ }
+ return 0;
+}
+
+void __exit edac_debugfs_exit(void)
+{
+ debugfs_remove(edac_debugfs);
+}
+
int edac_create_debug_nodes(struct mem_ctl_info *mci)
{
struct dentry *d, *parent;
char name[80];
int i;
- d = debugfs_create_dir(mci->dev.kobj.name, mci->debugfs);
+ if (!edac_debugfs)
+ return -ENODEV;
+
+ d = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs);
if (!d)
return -ENOMEM;
parent = d;
@@ -930,6 +950,7 @@ int edac_create_debug_nodes(struct mem_ctl_info *mci)
if (!d)
goto nomem;
+ mci->debugfs = parent;
return 0;
nomem:
debugfs_remove(mci->debugfs);