From aaa56f8a9319fde381a94e08d329f936ab1dfe42 Mon Sep 17 00:00:00 2001 From: Konstantin Dorfman Date: Mon, 13 May 2013 15:00:21 +0300 Subject: [PATCH] mmc: core: fix issue with HPI polling timeout Out of CPU time for the MMC context included into measured timeout. System under heavy load will easily exceed out_of_int_time (typically 20 ms), because the MMC context is not running and when it is back to running, timeout already elapsed. In this case real card status checked again and error reported for wrong card state only. Change-Id: I0da3bd2e7d41e4933ad3b1333d7135705a1eafec Signed-off-by: Konstantin Dorfman Signed-off-by: Sujit Reddy Thumma --- drivers/mmc/core/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 0be861b5649c..863df7a85220 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -727,8 +727,13 @@ int mmc_interrupt_hpi(struct mmc_card *card) if (!err && R1_CURRENT_STATE(status) == R1_STATE_TRAN) break; - if (time_after(jiffies, prg_wait)) - err = -ETIMEDOUT; + if (time_after(jiffies, prg_wait)) { + err = mmc_send_status(card, &status); + if (!err && R1_CURRENT_STATE(status) != R1_STATE_TRAN) + err = -ETIMEDOUT; + else + break; + } } while (!err); out: