edac_module.c (81d87cb13e367bb804bf44889ae0de7369705d6c) edac_module.c (91b99041c1d577ded1da599ddc28cec2e07253cf)
1/*
2 * edac_module.c
3 *
4 * (C) 2007 www.douglaskthompson.com
5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any
7 * warranty of any kind, whether express or implied.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * need to export to other files in this modules
31 */
32static struct sysdev_class edac_class = {
33 set_kset_name("edac"),
34};
35static int edac_class_valid = 0;
36
37/*
1/*
2 * edac_module.c
3 *
4 * (C) 2007 www.douglaskthompson.com
5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any
7 * warranty of any kind, whether express or implied.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * need to export to other files in this modules
31 */
32static struct sysdev_class edac_class = {
33 set_kset_name("edac"),
34};
35static int edac_class_valid = 0;
36
37/*
38 * edac_op_state_toString()
39 */
40char * edac_op_state_toString(int opstate)
41{
42 if (opstate == OP_RUNNING_POLL)
43 return "POLLED";
44 else if (opstate == OP_RUNNING_INTERRUPT)
45 return "INTERRUPT";
46 else if (opstate == OP_RUNNING_POLL_INTR)
47 return "POLL-INTR";
48 else if (opstate == OP_ALLOC)
49 return "ALLOC";
50 else if (opstate == OP_OFFLINE)
51 return "OFFLINE";
52
53 return "UNKNOWN";
54}
55
56/*
38 * edac_get_edac_class()
39 *
40 * return pointer to the edac class of 'edac'
41 */
42struct sysdev_class *edac_get_edac_class(void)
43{
44 struct sysdev_class *classptr=NULL;
45

--- 102 unchanged lines hidden (view full) ---

148 */
149 if (edac_sysfs_memctrl_setup()) {
150 edac_printk(KERN_ERR, EDAC_MC,
151 "Error initializing sysfs code\n");
152 err = -ENODEV;
153 goto error_sysfs;
154 }
155
57 * edac_get_edac_class()
58 *
59 * return pointer to the edac class of 'edac'
60 */
61struct sysdev_class *edac_get_edac_class(void)
62{
63 struct sysdev_class *classptr=NULL;
64

--- 102 unchanged lines hidden (view full) ---

167 */
168 if (edac_sysfs_memctrl_setup()) {
169 edac_printk(KERN_ERR, EDAC_MC,
170 "Error initializing sysfs code\n");
171 err = -ENODEV;
172 goto error_sysfs;
173 }
174
156 /* Create the PCI parity sysfs entries */
157 if (edac_sysfs_pci_setup()) {
158 edac_printk(KERN_ERR, EDAC_MC,
159 "PCI: Error initializing sysfs code\n");
160 err = -ENODEV;
161 goto error_mem;
162 }
163
164 /* Setup/Initialize the edac_device system */
165 err = edac_workqueue_setup();
166 if (err) {
167 edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n");
175 /* Setup/Initialize the edac_device system */
176 err = edac_workqueue_setup();
177 if (err) {
178 edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n");
168 goto error_pci;
179 goto error_mem;
169 }
170
171 return 0;
172
173 /* Error teardown stack */
180 }
181
182 return 0;
183
184 /* Error teardown stack */
174error_pci:
175 edac_sysfs_pci_teardown();
176error_mem:
177 edac_sysfs_memctrl_teardown();
178error_sysfs:
179 edac_unregister_sysfs_edac_name();
180error:
181 return err;
182}
183
184/*
185 * edac_exit()
186 * module exit/termination function
187 */
188static void __exit edac_exit(void)
189{
190 debugf0("%s()\n", __func__);
191
192 /* tear down the various subsystems*/
193 edac_workqueue_teardown();
194 edac_sysfs_memctrl_teardown();
185error_mem:
186 edac_sysfs_memctrl_teardown();
187error_sysfs:
188 edac_unregister_sysfs_edac_name();
189error:
190 return err;
191}
192
193/*
194 * edac_exit()
195 * module exit/termination function
196 */
197static void __exit edac_exit(void)
198{
199 debugf0("%s()\n", __func__);
200
201 /* tear down the various subsystems*/
202 edac_workqueue_teardown();
203 edac_sysfs_memctrl_teardown();
195 edac_sysfs_pci_teardown();
196 edac_unregister_sysfs_edac_name();
197}
198
199/*
200 * Inform the kernel of our entry and exit points
201 */
202module_init(edac_init);
203module_exit(edac_exit);

--- 12 unchanged lines hidden ---
204 edac_unregister_sysfs_edac_name();
205}
206
207/*
208 * Inform the kernel of our entry and exit points
209 */
210module_init(edac_init);
211module_exit(edac_exit);

--- 12 unchanged lines hidden ---