mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pei Xiao <xiaopei01@kylinos.cn>
To: shenyang39@huawei.com, broonie@kernel.org, f.fangjian@huawei.com,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pei Xiao <xiaopei01@kylinos.cn>
Subject: [PATCH 2/2] spi: hisi-kunpeng: Add timeout warning in FIFO flush function
Date: Thu, 19 Mar 2026 11:06:42 +0800	[thread overview]
Message-ID: <dad95ce42fb5677edfed32bc1f9b3e54df2cf8de.1773889292.git.xiaopei01@kylinos.cn> (raw)
In-Reply-To: <cover.1773889292.git.xiaopei01@kylinos.cn>

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>
---
 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


  parent reply	other threads:[~2026-03-19  3:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  3:06 [PATCH 0/2] spi hisi-kunpeng cleanup and fix Pei Xiao
2026-03-19  3:06 ` [PATCH 1/2] spi: hisi-kunpeng: prevent infinite while() loop in hisi_spi_flush_fifo Pei Xiao
2026-03-19  3:06 ` Pei Xiao [this message]
2026-03-19  3:08 ` [PATCH 0/2] spi hisi-kunpeng cleanup and fix Pei Xiao
2026-03-23 22:03 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dad95ce42fb5677edfed32bc1f9b3e54df2cf8de.1773889292.git.xiaopei01@kylinos.cn \
    --to=xiaopei01@kylinos.cn \
    --cc=broonie@kernel.org \
    --cc=f.fangjian@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=shenyang39@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®