aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-06-11 22:32:12 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-12 11:15:49 -0400
commite7930ba49e469d9ce7374a788336caf955f8d7e2 (patch)
treee022c408057f46881d8da9cfd9b76d5b34e551d5
parentc10538396bf3f0076630103ede49c863c27db720 (diff)
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>
-rw-r--r--drivers/edac/edac_mc_sysfs.c23
-rw-r--r--drivers/edac/edac_module.c3
-rw-r--r--drivers/edac/edac_module.h14
3 files changed, 39 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 = {
899}; 899};
900 900
901#ifdef CONFIG_EDAC_DEBUG 901#ifdef CONFIG_EDAC_DEBUG
902static struct dentry *edac_debugfs;
903
904int __init edac_debugfs_init(void)
905{
906 edac_debugfs = debugfs_create_dir("edac", NULL);
907 if (IS_ERR(edac_debugfs)) {
908 edac_debugfs = NULL;
909 return -ENOMEM;
910 }
911 return 0;
912}
913
914void __exit edac_debugfs_exit(void)
915{
916 debugfs_remove(edac_debugfs);
917}
918
902int edac_create_debug_nodes(struct mem_ctl_info *mci) 919int edac_create_debug_nodes(struct mem_ctl_info *mci)
903{ 920{
904 struct dentry *d, *parent; 921 struct dentry *d, *parent;
905 char name[80]; 922 char name[80];
906 int i; 923 int i;
907 924
908 d = debugfs_create_dir(mci->dev.kobj.name, mci->debugfs); 925 if (!edac_debugfs)
926 return -ENODEV;
927
928 d = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs);
909 if (!d) 929 if (!d)
910 return -ENOMEM; 930 return -ENOMEM;
911 parent = d; 931 parent = d;
@@ -930,6 +950,7 @@ int edac_create_debug_nodes(struct mem_ctl_info *mci)
930 if (!d) 950 if (!d)
931 goto nomem; 951 goto nomem;
932 952
953 mci->debugfs = parent;
933 return 0; 954 return 0;
934nomem: 955nomem:
935 debugfs_remove(mci->debugfs); 956 debugfs_remove(mci->debugfs);
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index 3454798c270e..58a28d838f37 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -94,6 +94,8 @@ static int __init edac_init(void)
94 if (err) 94 if (err)
95 goto error; 95 goto error;
96 96
97 edac_debugfs_init();
98
97 /* Setup/Initialize the workq for this core */ 99 /* Setup/Initialize the workq for this core */
98 err = edac_workqueue_setup(); 100 err = edac_workqueue_setup();
99 if (err) { 101 if (err) {
@@ -118,6 +120,7 @@ static void __exit edac_exit(void)
118 /* tear down the various subsystems */ 120 /* tear down the various subsystems */
119 edac_workqueue_teardown(); 121 edac_workqueue_teardown();
120 edac_mc_sysfs_exit(); 122 edac_mc_sysfs_exit();
123 edac_debugfs_exit();
121} 124}
122 125
123/* 126/*
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index 62de640c8c8a..3d139c6e7fe3 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -57,6 +57,20 @@ extern void edac_mc_reset_delay_period(int value);
57extern void *edac_align_ptr(void **p, unsigned size, int n_elems); 57extern void *edac_align_ptr(void **p, unsigned size, int n_elems);
58 58
59/* 59/*
60 * EDAC debugfs functions
61 */
62#ifdef CONFIG_EDAC_DEBUG
63int edac_debugfs_init(void);
64void edac_debugfs_exit(void);
65#else
66static inline int edac_debugfs_init(void)
67{
68 return -ENODEV;
69}
70static inline void edac_debugfs_exit(void) {}
71#endif
72
73/*
60 * EDAC PCI functions 74 * EDAC PCI functions
61 */ 75 */
62#ifdef CONFIG_PCI 76#ifdef CONFIG_PCI