Loading...
1// SPDX-License-Identifier: GPL-2.0-only
2#include "edac_module.h"
3
4static struct workqueue_struct *wq;
5
6bool edac_queue_work(struct delayed_work *work, unsigned long delay)
7{
8 return queue_delayed_work(wq, work, delay);
9}
10EXPORT_SYMBOL_GPL(edac_queue_work);
11
12bool edac_mod_work(struct delayed_work *work, unsigned long delay)
13{
14 return mod_delayed_work(wq, work, delay);
15}
16EXPORT_SYMBOL_GPL(edac_mod_work);
17
18bool edac_stop_work(struct delayed_work *work)
19{
20 bool ret;
21
22 ret = cancel_delayed_work_sync(work);
23 flush_workqueue(wq);
24
25 return ret;
26}
27EXPORT_SYMBOL_GPL(edac_stop_work);
28
29int edac_workqueue_setup(void)
30{
31 wq = alloc_ordered_workqueue("edac-poller", WQ_MEM_RECLAIM);
32 if (!wq)
33 return -ENODEV;
34 else
35 return 0;
36}
37
38void edac_workqueue_teardown(void)
39{
40 destroy_workqueue(wq);
41 wq = NULL;
42}
1#include "edac_module.h"
2
3static struct workqueue_struct *wq;
4
5bool edac_queue_work(struct delayed_work *work, unsigned long delay)
6{
7 return queue_delayed_work(wq, work, delay);
8}
9EXPORT_SYMBOL_GPL(edac_queue_work);
10
11bool edac_mod_work(struct delayed_work *work, unsigned long delay)
12{
13 return mod_delayed_work(wq, work, delay);
14}
15EXPORT_SYMBOL_GPL(edac_mod_work);
16
17bool 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}
26EXPORT_SYMBOL_GPL(edac_stop_work);
27
28int edac_workqueue_setup(void)
29{
30 wq = alloc_ordered_workqueue("edac-poller", WQ_MEM_RECLAIM);
31 if (!wq)
32 return -ENODEV;
33 else
34 return 0;
35}
36
37void edac_workqueue_teardown(void)
38{
39 flush_workqueue(wq);
40 destroy_workqueue(wq);
41 wq = NULL;
42}