hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/irq_work.h
....@@ -2,7 +2,7 @@
22 #ifndef _LINUX_IRQ_WORK_H
33 #define _LINUX_IRQ_WORK_H
44
5
-#include <linux/llist.h>
5
+#include <linux/smp_types.h>
66
77 /*
88 * An entry can be in one of four states:
....@@ -13,28 +13,29 @@
1313 * busy NULL, 2 -> {free, claimed} : callback in progress, can be claimed
1414 */
1515
16
-#define IRQ_WORK_PENDING BIT(0)
17
-#define IRQ_WORK_BUSY BIT(1)
18
-
19
-/* Doesn't want IPI, wait for tick: */
20
-#define IRQ_WORK_LAZY BIT(2)
21
-
22
-#define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)
23
-
2416 struct irq_work {
25
- unsigned long flags;
26
- struct llist_node llnode;
17
+ union {
18
+ struct __call_single_node node;
19
+ struct {
20
+ struct llist_node llnode;
21
+ atomic_t flags;
22
+ };
23
+ };
2724 void (*func)(struct irq_work *);
2825 };
2926
3027 static inline
3128 void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
3229 {
33
- work->flags = 0;
30
+ atomic_set(&work->flags, 0);
3431 work->func = func;
3532 }
3633
37
-#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }
34
+#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { \
35
+ .flags = ATOMIC_INIT(0), \
36
+ .func = (_f) \
37
+}
38
+
3839
3940 bool irq_work_queue(struct irq_work *work);
4041 bool irq_work_queue_on(struct irq_work *work, int cpu);
....@@ -47,9 +48,11 @@
4748
4849 void irq_work_run(void);
4950 bool irq_work_needs_cpu(void);
51
+void irq_work_single(void *arg);
5052 #else
5153 static inline bool irq_work_needs_cpu(void) { return false; }
5254 static inline void irq_work_run(void) { }
55
+static inline void irq_work_single(void *arg) { }
5356 #endif
5457
5558 #endif /* _LINUX_IRQ_WORK_H */