aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/edac_module.c')
-rw-r--r--drivers/edac/edac_module.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index 9cb082a19d8a..059b5924988b 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -92,6 +92,39 @@ static void edac_workqueue_teardown(void)
92} 92}
93 93
94/* 94/*
95 * sysfs object: /sys/devices/system/edac
96 * need to export to other files
97 */
98struct bus_type edac_subsys = {
99 .name = "edac",
100 .dev_name = "edac",
101};
102EXPORT_SYMBOL_GPL(edac_subsys);
103
104static int edac_subsys_init(void)
105{
106 int err;
107
108 /* create the /sys/devices/system/edac directory */
109 err = subsys_system_register(&edac_subsys, NULL);
110 if (err)
111 printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n");
112
113 return err;
114}
115
116static void edac_subsys_exit(void)
117{
118 bus_unregister(&edac_subsys);
119}
120
121/* return pointer to the 'edac' node in sysfs */
122struct bus_type *edac_get_sysfs_subsys(void)
123{
124 return &edac_subsys;
125}
126EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys);
127/*
95 * edac_init 128 * edac_init
96 * module initialization entry point 129 * module initialization entry point
97 */ 130 */
@@ -101,6 +134,10 @@ static int __init edac_init(void)
101 134
102 edac_printk(KERN_INFO, EDAC_MC, EDAC_VERSION "\n"); 135 edac_printk(KERN_INFO, EDAC_MC, EDAC_VERSION "\n");
103 136
137 err = edac_subsys_init();
138 if (err)
139 return err;
140
104 /* 141 /*
105 * Harvest and clear any boot/initialization PCI parity errors 142 * Harvest and clear any boot/initialization PCI parity errors
106 * 143 *
@@ -129,6 +166,8 @@ err_wq:
129 edac_mc_sysfs_exit(); 166 edac_mc_sysfs_exit();
130 167
131err_sysfs: 168err_sysfs:
169 edac_subsys_exit();
170
132 return err; 171 return err;
133} 172}
134 173
@@ -144,6 +183,7 @@ static void __exit edac_exit(void)
144 edac_workqueue_teardown(); 183 edac_workqueue_teardown();
145 edac_mc_sysfs_exit(); 184 edac_mc_sysfs_exit();
146 edac_debugfs_exit(); 185 edac_debugfs_exit();
186 edac_subsys_exit();
147} 187}
148 188
149/* 189/*