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:
Lingao Meng 2024-09-24 10:50:59 +08:00 committed by Fabio Baltieri
commit 2a3b28a3f5

View file

@ -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 {