Commit 2a3b28a3 authored by Lingao Meng's avatar Lingao Meng Committed by Fabio Baltieri
Browse files

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: default avatarLingao Meng <menglingao@xiaomi.com>
parent 8e881959
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -188,19 +188,9 @@ static void queue_flusher_locked(struct k_work_q *queue,
				 struct k_work *work,
				 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);
	if (in_list) {

	if ((flags_get(&work->flags) & K_WORK_QUEUED) != 0U) {
		sys_slist_insert(&queue->pending, &work->node,
				 &flusher->work.node);
	} else {