From: Kaitao Cheng <[email protected]> A later change will make list_for_each_entry() cache the next element before entering the loop body. stm32_ospi_transfer_one_message() can consume the following transfer as part of the current operation and then advance the loop cursor to that entry.
Keep the transfer walk open-coded so the loop step observes that cursor update and skips the consumed transfer. This preserves the existing message sequencing semantics and prepares the code for the list iterator update. Signed-off-by: Kaitao Cheng <[email protected]> --- drivers/spi/spi-stm32-ospi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c index 4461c6e24b9e..4dc2b56b4c20 100644 --- a/drivers/spi/spi-stm32-ospi.c +++ b/drivers/spi/spi-stm32-ospi.c @@ -675,7 +675,9 @@ static int stm32_ospi_transfer_one_message(struct spi_controller *ctrl, gpiod_set_value_cansleep(cs_gpiod, true); - list_for_each_entry(transfer, &msg->transfers, transfer_list) { + for (transfer = list_first_entry(&msg->transfers, typeof(*transfer), transfer_list); + !list_entry_is_head(transfer, &msg->transfers, transfer_list); + transfer = list_next_entry(transfer, transfer_list)) { u8 dummy_bytes = 0; memset(&op, 0, sizeof(op)); -- 2.43.0
