aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/workqueues.h
blob: e58c8dfd3e901af3284945e1b9529c711ce521f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef WORKQUEUES_H
#define WORKQUEUES_H

#include <stdbool.h>

#include "barriers.h"
#include "bug_on.h"
#include "int_typedefs.h"

#include <linux/types.h>

/* Stub workqueue implementation. */

struct work_struct;
typedef void (*work_func_t)(struct work_struct *work);
void delayed_work_timer_fn(unsigned long __data);

struct work_struct {
/*	atomic_long_t data; */
	unsigned long data;

	struct list_head entry;
	work_func_t func;
#ifdef CONFIG_LOCKDEP
	struct lockdep_map lockdep_map;
#endif
};

struct timer_list {
	struct hlist_node	entry;
	unsigned long		expires;
	void			(*function)(unsigned long);
	unsigned long		data;
	u32			flags;
	int			slack;
};

struct delayed_work {
	struct work_struct work;
	struct timer_list timer;

	/* target workqueue and CPU ->timer uses to queue ->work */
	struct workqueue_struct *wq;
	int cpu;
};


static inline bool schedule_work(struct work_struct *work)
{
	BUG();
	return true;
}

static inline bool schedule_work_on(int cpu, struct work_struct *work)
{
	BUG();
	return true;
}

static inline bool queue_work(struct workqueue_struct *wq,
			      struct work_struct *work)
{
	BUG();
	return true;
}

static inline bool queue_delayed_work(struct workqueue_struct *wq,
				      struct delayed_work *dwork,
				      unsigned long delay)
{
	BUG();
	return true;
}

#define INIT_WORK(w, f) \
	do { \
		(w)->data = 0; \
		(w)->func = (f); \
	} while (0)

#define INIT_DELAYED_WORK(w, f) INIT_WORK(&(w)->work, (f))

#define __WORK_INITIALIZER(n, f) { \
		.data = 0, \
		.entry = { &(n).entry, &(n).entry }, \
		.func = f \
	}

/* Don't bother initializing timer. */
#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \
	.work = __WORK_INITIALIZER((n).work, (f)), \
	}

#define DECLARE_WORK(n, f) \
	struct workqueue_struct n = __WORK_INITIALIZER

#define DECLARE_DELAYED_WORK(n, f) \
	struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)

#define system_power_efficient_wq ((struct workqueue_struct *) NULL)

#endif