kernel: work: Remove meanless foreach for work
Since call this function both in ```C k_spinlock_key_t key = k_spin_lock(&lock); bool need_flush = work_flush_locked(work, flusher); k_spin_unlock(&lock, key); ``` So, there are no flag_get change. Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
parent
8e881959a4
commit
2a3b28a3f5
1 changed files with 2 additions and 12 deletions
|
@ -188,19 +188,9 @@ static void queue_flusher_locked(struct k_work_q *queue,
|
||||||
struct k_work *work,
|
struct k_work *work,
|
||||||
struct z_work_flusher *flusher)
|
struct z_work_flusher *flusher)
|
||||||
{
|
{
|
||||||
bool in_list = false;
|
|
||||||
struct k_work *wn;
|
|
||||||
|
|
||||||
/* Determine whether the work item is still queued. */
|
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&queue->pending, wn, node) {
|
|
||||||
if (wn == work) {
|
|
||||||
in_list = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init_flusher(flusher);
|
init_flusher(flusher);
|
||||||
if (in_list) {
|
|
||||||
|
if ((flags_get(&work->flags) & K_WORK_QUEUED) != 0U) {
|
||||||
sys_slist_insert(&queue->pending, &work->node,
|
sys_slist_insert(&queue->pending, &work->node,
|
||||||
&flusher->work.node);
|
&flusher->work.node);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue