Borislav Petkov | c4cf3b4 | 2015-11-30 19:02:01 +0100 | [diff] [blame] | 1 | #include "edac_module.h" |
| 2 | |
| 3 | static struct workqueue_struct *wq; |
| 4 | |
| 5 | bool edac_queue_work(struct delayed_work *work, unsigned long delay) |
| 6 | { |
| 7 | return queue_delayed_work(wq, work, delay); |
| 8 | } |
| 9 | EXPORT_SYMBOL_GPL(edac_queue_work); |
| 10 | |
| 11 | bool edac_mod_work(struct delayed_work *work, unsigned long delay) |
| 12 | { |
| 13 | return mod_delayed_work(wq, work, delay); |
| 14 | } |
| 15 | EXPORT_SYMBOL_GPL(edac_mod_work); |
| 16 | |
| 17 | bool edac_stop_work(struct delayed_work *work) |
| 18 | { |
| 19 | bool ret; |
| 20 | |
| 21 | ret = cancel_delayed_work_sync(work); |
| 22 | flush_workqueue(wq); |
| 23 | |
| 24 | return ret; |
| 25 | } |
| 26 | EXPORT_SYMBOL_GPL(edac_stop_work); |
| 27 | |
| 28 | int edac_workqueue_setup(void) |
| 29 | { |
| 30 | wq = create_singlethread_workqueue("edac-poller"); |
| 31 | if (!wq) |
| 32 | return -ENODEV; |
| 33 | else |
| 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | void edac_workqueue_teardown(void) |
| 38 | { |
| 39 | flush_workqueue(wq); |
| 40 | destroy_workqueue(wq); |
| 41 | wq = NULL; |
| 42 | } |