History

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. ]

Frederic Weisbecker committed 7 years ago

Commit 153bedb1 parent 31f4f5b5 files · +19 −15Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/irq_work.h+7−3
@@ -22,7 +22,7 @@ · 21 unmodified lines
22#define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)22#define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)
23 23
24struct irq_work {24struct irq_work {
25 unsigned long flags;25 atomic_t flags;
26 struct llist_node llnode;26 struct llist_node llnode;
27 void (*func)(struct irq_work *);27 void (*func)(struct irq_work *);
28};28};
@@ -30,11 +30,15 @@ struct irq_work { · 1 unmodified line
30static inline30static inline
31void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))31void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
32{32{
33 work->flags = 0;33 atomic_set(&work->flags, 0);
34 work->func = func;34 work->func = func;
35}35}
36 36
37#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { .func = (_f), }37#define DEFINE_IRQ_WORK(name, _f) struct irq_work name = { \
38 .flags = ATOMIC_INIT(0), \
39 .func = (_f) \
40}
41
38 42
39bool irq_work_queue(struct irq_work *work);43bool irq_work_queue(struct irq_work *work);
40bool irq_work_queue_on(struct irq_work *work, int cpu);44bool irq_work_queue_on(struct irq_work *work, int cpu);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t