From patchwork Mon May 13 08:28:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Dorfman X-Patchwork-Id: 2556991 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 424CD3FC5A for ; Mon, 13 May 2013 08:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752707Ab3EMIbm (ORCPT ); Mon, 13 May 2013 04:31:42 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:63751 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751523Ab3EMIbl (ORCPT ); Mon, 13 May 2013 04:31:41 -0400 X-IronPort-AV: E=Sophos;i="4.87,660,1363158000"; d="scan'208";a="46549908" Received: from pdmz-ns-snip_115_219.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.115.219]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 May 2013 01:31:41 -0700 Received: from lx-kdorfman2.qi.qualcomm.com (pdmz-ns-snip_218_1.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id 0BB6B10004C9; Mon, 13 May 2013 01:31:38 -0700 (PDT) From: Konstantin Dorfman To: cjb@laptop.org Cc: sthumma@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-mmc@vger.kernel.org, merez@codeaurora.org, Konstantin Dorfman Subject: [RFC/PATCH] mmc: core: fix HPI polling timeout Date: Mon, 13 May 2013 11:28:42 +0300 Message-Id: <1368433722-17503-1-git-send-email-kdorfman@codeaurora.org> X-Mailer: git-send-email 1.7.6 In-Reply-To: References: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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). In this case real card status checked again and error reported for wrong card state only. Signed-off-by: Konstantin Dorfman Signed-off-by: Sujith Reddy Thumma diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index c40396f..4d06ada 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -630,8 +630,11 @@ 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; + } } while (!err); out: