Skip to content

Commit 1187e17

Browse files
ubiedacfriedt
authored andcommitted
rtio: fix CQE semaphore by not giving it no CQE item was created
Otherwise, calls to rtio_cqe_consume_block will bypass the semaphore and held back in a Z_SPIN_DELAY(1) indefinitely. Signed-off-by: Luis Ubieda <[email protected]>
1 parent b49e385 commit 1187e17

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/zephyr/rtio/rtio.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,9 @@ static inline void rtio_cqe_submit(struct rtio *r, int result, void *userdata, u
13091309
cqe->userdata = userdata;
13101310
cqe->flags = flags;
13111311
rtio_cqe_produce(r, cqe);
1312+
#ifdef CONFIG_RTIO_CONSUME_SEM
1313+
k_sem_give(r->consume_sem);
1314+
#endif
13121315
}
13131316

13141317
/* atomic_t isn't guaranteed to wrap correctly as it could be signed, so
@@ -1329,9 +1332,6 @@ static inline void rtio_cqe_submit(struct rtio *r, int result, void *userdata, u
13291332
}
13301333
}
13311334
#endif
1332-
#ifdef CONFIG_RTIO_CONSUME_SEM
1333-
k_sem_give(r->consume_sem);
1334-
#endif
13351335
}
13361336

13371337
#define __RTIO_MEMPOOL_GET_NUM_BLKS(num_bytes, blk_size) (((num_bytes) + (blk_size)-1) / (blk_size))

0 commit comments

Comments
 (0)