]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: hisi-kunpeng: Add timeout warning in FIFO flush function
authorPei Xiao <xiaopei01@kylinos.cn>
Thu, 19 Mar 2026 03:06:42 +0000 (11:06 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 23 Mar 2026 22:02:40 +0000 (22:02 +0000)
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@kylinos.cn>
Link: https://patch.msgid.link/dad95ce42fb5677edfed32bc1f9b3e54df2cf8de.1773889292.git.xiaopei01@kylinos.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-hisi-kunpeng.c

index c42d2a2cdf1e469570772a4ee4b939e08c556493..046bd894040b10a58c72bd9d4c298106bc0a66ec 100644 (file)
@@ -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 */