sdhci_compute_timeout looks at the timeout values in both cmd and data
and if both are NULL falls back to SDHCI_CMD_DEFAULT_BUSY_TIMEOUT_NS.

It's thus can be used as-is in sdhci_wait_idle_data to reduce the
difference to sdhci_wait_idle in preparation for their merger.

Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
---
 drivers/mci/sdhci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index 38a108adb1a8..f0c95f2dbfa8 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -856,14 +856,12 @@ int sdhci_wait_idle_data(struct sdhci *host, struct 
mci_cmd *cmd)
        int ret;
 
        mask = SDHCI_CMD_INHIBIT_CMD | SDHCI_CMD_INHIBIT_DATA;
-       timeout_ns = SDHCI_CMD_DEFAULT_BUSY_TIMEOUT_NS;
 
        if (cmd && (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION ||
                    mmc_op_tuning(cmd->cmdidx)))
                mask &= ~SDHCI_CMD_INHIBIT_DATA;
 
-       if (cmd && cmd->busy_timeout != 0)
-               timeout_ns = ms_to_ktime(cmd->busy_timeout);
+       timeout_ns = sdhci_compute_timeout(cmd, NULL);
 
        ret = wait_on_timeout(timeout_ns,
                        !(sdhci_read32(host, SDHCI_PRESENT_STATE) & mask));
-- 
2.39.5


Reply via email to