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. ]
Showing the changes to include/linux (1 of 5 files). Show all
Unified · Split
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY) |
| 23 | 23 | |
| 24 | 24 | struct irq_work { |
| 25 | − unsigned long flags; | |
| 25 | + atomic_t flags; | |
| 26 | 26 | struct llist_node llnode; |
| 27 | 27 | void (*func)(struct irq_work *); |
| 28 | 28 | }; |
| @@ -30,11 +30,15 @@ struct irq_work { · 1 unmodified line | ||
| 30 | 30 | static inline |
| 31 | 31 | void 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 | 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 | |
| 39 | 43 | bool irq_work_queue(struct irq_work *work); |
| 40 | 44 | bool irq_work_queue_on(struct irq_work *work, int cpu); |