Work flags are about to see more traditional mask handling. Define WORK_STRUCT_*_BIT as the bit position constant and redefine WORK_STRUCT_* as bit masks. Also, make WORK_STRUCT_STATIC_* flags conditional While at it, re-define these constants as enums and use WORK_STRUCT_STATIC instead of hard-coding 2 in WORK_DATA_STATIC_INIT().
Showing the changes to kernel/workqueue.c (1 of 2 files). Show all
Unified · Split
| @@ -115,7 +115,7 @@ static int work_fixup_activate(void *addr, enum debug_obj_state state) · 114 unmodified lines | ||
| 115 | 115 | * statically initialized. We just make sure that it |
| 116 | 116 | * is tracked in the object tracker. |
| 117 | 117 | */ |
| 118 | − if (test_bit(WORK_STRUCT_STATIC, work_data_bits(work))) { | |
| 118 | + if (test_bit(WORK_STRUCT_STATIC_BIT, work_data_bits(work))) { | |
| 119 | 119 | debug_object_init(work, &work_debug_descr); |
| 120 | 120 | debug_object_activate(work, &work_debug_descr); |
| 121 | 121 | return 0; |
| @@ -232,7 +232,7 @@ static inline void set_wq_data(struct work_struct *work, · 110 unmodified lines | ||
| 232 | 232 | BUG_ON(!work_pending(work)); |
| 233 | 233 | |
| 234 | 234 | atomic_long_set(&work->data, (unsigned long)cwq | work_static(work) | |
| 235 | − (1UL << WORK_STRUCT_PENDING) | extra_flags); | |
| 235 | + WORK_STRUCT_PENDING | extra_flags); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /* |
| @@ -330,7 +330,7 @@ queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work) · 91 unmodified lines | ||
| 330 | 330 | { |
| 331 | 331 | int ret = 0; |
| 332 | 332 | |
| 333 | − if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) { | |
| 333 | + if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { | |
| 334 | 334 | __queue_work(cpu, wq, work); |
| 335 | 335 | ret = 1; |
| 336 | 336 | } |
| @@ -380,7 +380,7 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, · 43 unmodified lines | ||
| 380 | 380 | struct timer_list *timer = &dwork->timer; |
| 381 | 381 | struct work_struct *work = &dwork->work; |
| 382 | 382 | |
| 383 | − if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) { | |
| 383 | + if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { | |
| 384 | 384 | BUG_ON(timer_pending(timer)); |
| 385 | 385 | BUG_ON(!list_empty(&work->entry)); |
| 386 | 386 | |
| @@ -516,7 +516,7 @@ static void insert_wq_barrier(struct cpu_workqueue_struct *cwq, · 129 unmodified lines | ||
| 516 | 516 | * might deadlock. |
| 517 | 517 | */ |
| 518 | 518 | INIT_WORK_ON_STACK(&barr->work, wq_barrier_func); |
| 519 | − __set_bit(WORK_STRUCT_PENDING, work_data_bits(&barr->work)); | |
| 519 | + __set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work)); | |
| 520 | 520 | init_completion(&barr->done); |
| 521 | 521 | |
| 522 | 522 | debug_work_activate(&barr->work); |
| @@ -628,7 +628,7 @@ static int try_to_grab_pending(struct work_struct *work) · 105 unmodified lines | ||
| 628 | 628 | struct cpu_workqueue_struct *cwq; |
| 629 | 629 | int ret = -1; |
| 630 | 630 | |
| 631 | − if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) | |
| 631 | + if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) | |
| 632 | 632 | return 0; |
| 633 | 633 | |
| 634 | 634 | /* |