From: Kaitao Cheng <[email protected]>

A later change will make list_for_each_entry() cache the next element
before entering the loop body. tegra_qspi_non_combined_seq_xfer() 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-tegra210-quad.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index db28dd556484..42dd5cf53c67 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -1302,7 +1302,9 @@ static int tegra_qspi_non_combined_seq_xfer(struct 
tegra_qspi *tqspi,
        if (tqspi->soc_data->supports_tpm)
                val &= ~QSPI_TPM_WAIT_POLL_EN;
        tegra_qspi_writel(tqspi, val, QSPI_GLOBAL_CONFIG);
-       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)) {
                struct spi_transfer *xfer = transfer;
                u8 dummy_bytes = 0;
                u32 cmd1;
-- 
2.43.0

Reply via email to