From: Pei Xiao Date: Thu, 19 Mar 2026 03:06:42 +0000 (+0800) Subject: spi: hisi-kunpeng: Add timeout warning in FIFO flush function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=579a49aaab0814c55595cddf0be9651e37972f6a;p=thirdparty%2Fkernel%2Flinux.git spi: hisi-kunpeng: Add timeout warning in FIFO flush function 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 Link: https://patch.msgid.link/dad95ce42fb5677edfed32bc1f9b3e54df2cf8de.1773889292.git.xiaopei01@kylinos.cn Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c index c42d2a2cdf1e4..046bd894040b1 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 */