From: Kaitao Cheng <[email protected]> A later change will make list_for_each_entry() cache the next element before entering the loop body. fsi_spi_transfer_one_message() can combine the current transfer with the following transfer and then advance the cursor to that consumed 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-fsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c index f6a75f0184c4..44999f00f5f6 100644 --- a/drivers/spi/spi-fsi.c +++ b/drivers/spi/spi-fsi.c @@ -434,7 +434,10 @@ static int fsi_spi_transfer_one_message(struct spi_controller *ctlr, if (rc) goto error; - list_for_each_entry(transfer, &mesg->transfers, transfer_list) { + for (transfer = list_first_entry(&mesg->transfers, + typeof(*transfer), transfer_list); + !list_entry_is_head(transfer, &mesg->transfers, transfer_list); + transfer = list_next_entry(transfer, transfer_list)) { struct fsi_spi_sequence seq; struct spi_transfer *next = NULL; -- 2.43.0
