]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/edac/edac_module.c
2 #include <linux/freezer.h>
3 #include <linux/kthread.h>
6 #include "edac_module.h"
8 #define EDAC_MC_VERSION "Ver: 2.0.3" __DATE__
10 #ifdef CONFIG_EDAC_DEBUG
11 /* Values of 0 to 4 will generate output */
12 int edac_debug_level
= 1;
13 EXPORT_SYMBOL_GPL(edac_debug_level
);
16 static struct task_struct
*edac_thread
;
19 * Check MC status every edac_get_poll_msec().
20 * Check PCI status every edac_get_poll_msec() as well.
22 * This where the work gets done for edac.
24 * SMP safe, doesn't use NMI, and auto-rate-limits.
26 static void do_edac_check(void)
28 debugf3("%s()\n", __func__
);
30 /* perform the poll activities */
31 edac_check_mc_devices();
32 edac_pci_do_parity_check();
36 * Action thread for EDAC to perform the POLL operations
38 static int edac_kernel_thread(void *arg
)
42 while (!kthread_should_stop()) {
46 /* goto sleep for the interval */
47 msec
= (HZ
* edac_get_poll_msec()) / 1000;
48 schedule_timeout_interruptible(msec
);
57 * module initialization entry point
59 static int __init
edac_init(void)
61 edac_printk(KERN_INFO
, EDAC_MC
, EDAC_MC_VERSION
"\n");
64 * Harvest and clear any boot/initialization PCI parity errors
66 * FIXME: This only clears errors logged by devices present at time of
67 * module initialization. We should also do an initial clear
68 * of each newly hotplugged device.
70 edac_pci_clear_parity_errors();
72 /* Create the MC sysfs entries */
73 if (edac_sysfs_memctrl_setup()) {
74 edac_printk(KERN_ERR
, EDAC_MC
,
75 "Error initializing sysfs code\n");
79 /* Create the PCI parity sysfs entries */
80 if (edac_sysfs_pci_setup()) {
81 edac_sysfs_memctrl_teardown();
82 edac_printk(KERN_ERR
, EDAC_MC
,
83 "PCI: Error initializing sysfs code\n");
87 /* create our kernel thread */
88 edac_thread
= kthread_run(edac_kernel_thread
, NULL
, "kedac");
90 if (IS_ERR(edac_thread
)) {
91 /* remove the sysfs entries */
92 edac_sysfs_memctrl_teardown();
93 edac_sysfs_pci_teardown();
94 return PTR_ERR(edac_thread
);
102 * module exit/termination function
104 static void __exit
edac_exit(void)
106 debugf0("%s()\n", __func__
);
107 kthread_stop(edac_thread
);
109 /* tear down the sysfs device */
110 edac_sysfs_memctrl_teardown();
111 edac_sysfs_pci_teardown();
115 * Inform the kernel of our entry and exit points
117 module_init(edac_init
);
118 module_exit(edac_exit
);
120 MODULE_LICENSE("GPL");
121 MODULE_AUTHOR("Doug Thompson www.softwarebitmaker.com, et al");
122 MODULE_DESCRIPTION("Core library routines for EDAC reporting");
124 /* refer to *_sysfs.c files for parameters that are exported via sysfs */
126 #ifdef CONFIG_EDAC_DEBUG
127 module_param(edac_debug_level
, int, 0644);
128 MODULE_PARM_DESC(edac_debug_level
, "Debug level");