[PATCH 1/2] mci: atmel_mci: fix off-by-1000 in poll timeout

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jan 11 09:39:20 PST 2023


read_poll_timeout assumes microsecond timeouts, not nanoseconds. One
second instead of a thousand is still plenty time when polling for a
MCI controller to change state, so use that.

Fixes: 4fc0369b1a55 ("mci: atmel_mci: add PBL support")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/mci/atmel_mci_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/atmel_mci_common.c b/drivers/mci/atmel_mci_common.c
index c8e21933fe51..99e65adb2cf0 100644
--- a/drivers/mci/atmel_mci_common.c
+++ b/drivers/mci/atmel_mci_common.c
@@ -90,8 +90,8 @@ static int atmci_poll_status(struct atmel_mci *host, u32 mask)
 	u32 stat;
 	int ret;
 
-	ret = read_poll_timeout(atmci_readl, stat, (stat & mask), SECOND, host,
-				ATMCI_SR);
+	ret = read_poll_timeout(atmci_readl, stat, (stat & mask), USEC_PER_SEC,
+				host, ATMCI_SR);
 	if (ret < 0) {
 		dev_err(host->hw_dev, "timeout\n");
 		host->need_reset = true;
-- 
2.30.2




More information about the barebox mailing list