public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for 5.10.y 2/2] mmc: sdhci: Return true only when timeout exceeds capacity of the HW timer
@ 2026-02-16  4:49 Nobuhiro Iwamatsu
  2026-02-17 12:42 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Nobuhiro Iwamatsu @ 2026-02-16  4:49 UTC (permalink / raw)
  To: stable; +Cc: gregkh, sashal, Bean Huo, Ulf Hansson, Nobuhiro Iwamatsu

From: Bean Huo <beanhuo@micron.com>

commit 9c6bb8c6a1a48608692f3c8c21be13b759ec9056 upstream.

Clean up sdhci_calc_timeout() a bit,  and let it set too_big to be true only
when the timeout value required by the eMMC device exceeds the capability of
the host hardware timer.

Signed-off-by: Bean Huo <beanhuo@micron.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20210917172727.26834-2-huobean@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
---
 drivers/mmc/host/sdhci.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 435df5ccaba62..decf70e560e35 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -944,7 +944,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
 	struct mmc_data *data;
 	unsigned target_timeout, current_timeout;
 
-	*too_big = true;
+	*too_big = false;
 
 	/*
 	 * If the host controller provides us with an incorrect timeout
@@ -955,7 +955,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
 	if (host->quirks & SDHCI_QUIRK_BROKEN_TIMEOUT_VAL)
 		return host->max_timeout_count;
 
-	/* Unspecified command, asume max */
+	/* Unspecified command, assume max */
 	if (cmd == NULL)
 		return host->max_timeout_count;
 
@@ -982,17 +982,14 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,
 	while (current_timeout < target_timeout) {
 		count++;
 		current_timeout <<= 1;
-		if (count > host->max_timeout_count)
+		if (count > host->max_timeout_count) {
+			if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT))
+				DBG("Too large timeout 0x%x requested for CMD%d!\n",
+				    count, cmd->opcode);
+			count = host->max_timeout_count;
+			*too_big = true;
 			break;
-	}
-
-	if (count > host->max_timeout_count) {
-		if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT))
-			DBG("Too large timeout 0x%x requested for CMD%d!\n",
-			    count, cmd->opcode);
-		count = host->max_timeout_count;
-	} else {
-		*too_big = false;
+		}
 	}
 
 	return count;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for 5.10.y 2/2] mmc: sdhci: Return true only when timeout exceeds capacity of the HW timer
  2026-02-16  4:49 [PATCH for 5.10.y 2/2] mmc: sdhci: Return true only when timeout exceeds capacity of the HW timer Nobuhiro Iwamatsu
@ 2026-02-17 12:42 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-02-17 12:42 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: stable, sashal, Bean Huo, Ulf Hansson

On Mon, Feb 16, 2026 at 01:49:17PM +0900, Nobuhiro Iwamatsu wrote:
> From: Bean Huo <beanhuo@micron.com>
> 
> commit 9c6bb8c6a1a48608692f3c8c21be13b759ec9056 upstream.
> 
> Clean up sdhci_calc_timeout() a bit,  and let it set too_big to be true only
> when the timeout value required by the eMMC device exceeds the capability of
> the host hardware timer.
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> Link: https://lore.kernel.org/r/20210917172727.26834-2-huobean@gmail.com
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
> ---

Why is this only for 5.10.y?  What about 5.15.y?  And why is this needed
at all?  What bug is this fixing?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-17 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16  4:49 [PATCH for 5.10.y 2/2] mmc: sdhci: Return true only when timeout exceeds capacity of the HW timer Nobuhiro Iwamatsu
2026-02-17 12:42 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox