Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / edac / wq.c
blobd021d287eaec60cc935370ab07ba5ab02c577e94
1 // SPDX-License-Identifier: GPL-2.0-only
2 #include "edac_module.h"
4 static struct workqueue_struct *wq;
6 bool edac_queue_work(struct delayed_work *work, unsigned long delay)
8 return queue_delayed_work(wq, work, delay);
10 EXPORT_SYMBOL_GPL(edac_queue_work);
12 bool edac_mod_work(struct delayed_work *work, unsigned long delay)
14 return mod_delayed_work(wq, work, delay);
16 EXPORT_SYMBOL_GPL(edac_mod_work);
18 bool edac_stop_work(struct delayed_work *work)
20 bool ret;
22 ret = cancel_delayed_work_sync(work);
23 flush_workqueue(wq);
25 return ret;
27 EXPORT_SYMBOL_GPL(edac_stop_work);
29 int edac_workqueue_setup(void)
31 wq = alloc_ordered_workqueue("edac-poller", WQ_MEM_RECLAIM);
32 if (!wq)
33 return -ENODEV;
34 else
35 return 0;
38 void edac_workqueue_teardown(void)
40 flush_workqueue(wq);
41 destroy_workqueue(wq);
42 wq = NULL;