aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/irq_work.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <frederic@kernel.org>2019-11-08 17:08:55 +0100
committerIngo Molnar <mingo@kernel.org>2019-11-11 09:02:56 +0100
commit153bedbac2ebd475e1c7c2d2fa0c042f5525927d (patch)
tree80be4ee2af1d7aa3cc52be50c225f32002dd2dad /include/linux/irq_work.h
parentLinux 5.4-rc7 (diff)
downloadwireguard-linux-153bedbac2ebd475e1c7c2d2fa0c042f5525927d.tar.xz
wireguard-linux-153bedbac2ebd475e1c7c2d2fa0c042f5525927d.zip
irq_work: Convert flags to atomic_t
We need to convert flags to atomic_t in order to later fix an ordering issue on atomic_cmpxchg() failure. This will allow us to use atomic_fetch_or(). Also clarify the nature of those flags. [ mingo: Converted two more usage site the original patch missed. ] Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20191108160858.31665-2-frederic@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/irq_work.h')
-rw-r--r--include/linux/irq_work.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index b11fcdfd0770..02da997ad12c 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -22,7 +22,7 @@
#define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)
struct irq_work {
- unsigned long flags;
+ atomic_t flags;
struct llist_node llnode;
void (*func)(struct irq_work *);
};
@@ -30,11 +30,15 @@ struct irq_work {
static inline
void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
{
- work->flags = 0;
+ atomic_set(&work->flags, 0);
work->func = func;
}
-#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }
+#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { \
+ .flags = ATOMIC_INIT(0), \
+ .func = (_f) \
+}
+
bool irq_work_queue(struct irq_work *work);
bool irq_work_queue_on(struct irq_work *work, int cpu);