[PATCH 2/2] spi: hisi-kunpeng: Add timeout warning in FIFO flush function

From: Pei Xiao

Date: Wed Mar 18 2026 - 23:07:42 EST


When flushing the FIFO, the driver waits for the busy flag to clear
with a timeout. Change the loop condition to use pre-decrement (--limit)
instead of post-decrement (limit--) so that warning message can show. Add a
ratelimited warning message to log SPI busy timeout events, aiding in
debugging.

Signed-off-by: Pei Xiao <xiaopei01@xxxxxxxxxx>
---
drivers/spi/spi-hisi-kunpeng.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c
index c42d2a2cdf1e..046bd894040b 100644
--- a/drivers/spi/spi-hisi-kunpeng.c
+++ b/drivers/spi/spi-hisi-kunpeng.c
@@ -208,7 +208,10 @@ static void hisi_spi_flush_fifo(struct hisi_spi *hs)
break;
}

- } while (hisi_spi_busy(hs) && limit--);
+ } while (hisi_spi_busy(hs) && --limit);
+
+ if (!limit)
+ dev_warn_ratelimited(hs->dev, "SPI busy timeout\n");
}

/* Disable the controller and all interrupts */
--
2.25.1