spi: context: update state when already locked

Update the context state parameters when the context is already locked.
This allows changing the callback information for asynchronous
operations while the context is locked.

Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2024-12-09 11:40:26 +10:00 committed by Benjamin Cabé
parent ebc2ca59e3
commit 13df3b9f62

View file

@ -96,12 +96,10 @@ static inline void spi_context_lock(struct spi_context *ctx,
(k_sem_count_get(&ctx->lock) == 0) &&
(ctx->owner == spi_cfg);
if (already_locked) {
return;
}
if (!already_locked) {
k_sem_take(&ctx->lock, K_FOREVER);
ctx->owner = spi_cfg;
}
#ifdef CONFIG_SPI_ASYNC
ctx->asynchronous = asynchronous;