0001
0002 #include "edac_module.h"
0003
0004 static struct workqueue_struct *wq;
0005
0006 bool edac_queue_work(struct delayed_work *work, unsigned long delay)
0007 {
0008 return queue_delayed_work(wq, work, delay);
0009 }
0010 EXPORT_SYMBOL_GPL(edac_queue_work);
0011
0012 bool edac_mod_work(struct delayed_work *work, unsigned long delay)
0013 {
0014 return mod_delayed_work(wq, work, delay);
0015 }
0016 EXPORT_SYMBOL_GPL(edac_mod_work);
0017
0018 bool edac_stop_work(struct delayed_work *work)
0019 {
0020 bool ret;
0021
0022 ret = cancel_delayed_work_sync(work);
0023 flush_workqueue(wq);
0024
0025 return ret;
0026 }
0027 EXPORT_SYMBOL_GPL(edac_stop_work);
0028
0029 int edac_workqueue_setup(void)
0030 {
0031 wq = alloc_ordered_workqueue("edac-poller", WQ_MEM_RECLAIM);
0032 if (!wq)
0033 return -ENODEV;
0034 else
0035 return 0;
0036 }
0037
0038 void edac_workqueue_teardown(void)
0039 {
0040 flush_workqueue(wq);
0041 destroy_workqueue(wq);
0042 wq = NULL;
0043 }