From patchwork Thu Jan 19 16:39:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 6298 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CEEF523F02 for ; Thu, 19 Jan 2012 16:40:20 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id A8832A18185 for ; Thu, 19 Jan 2012 16:40:20 +0000 (UTC) Received: by bkbzt4 with SMTP id zt4so155367bkb.11 for ; Thu, 19 Jan 2012 08:40:20 -0800 (PST) Received: by 10.205.139.66 with SMTP id iv2mr10541608bkc.27.1326991220051; Thu, 19 Jan 2012 08:40:20 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs16890bkc; Thu, 19 Jan 2012 08:40:19 -0800 (PST) Received: by 10.213.3.68 with SMTP id 4mr7179485ebm.135.1326991217642; Thu, 19 Jan 2012 08:40:17 -0800 (PST) Received: from eu1sys200aog119.obsmtp.com (eu1sys200aog119.obsmtp.com. [207.126.144.147]) by mx.google.com with SMTP id y50si20240568eef.158.2012.01.19.08.40.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 08:40:17 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.147; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) smtp.mail=ulf.hansson@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob119.postini.com ([207.126.147.11]) with SMTP ID DSNKTxhHaKLwqcsoN7mFS+DmVWcZBN3Qmziz@postini.com; Thu, 19 Jan 2012 16:40:17 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 11E6DC3; Thu, 19 Jan 2012 16:31:34 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 700A614CD; Thu, 19 Jan 2012 16:40:01 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 46531A8072; Thu, 19 Jan 2012 17:39:54 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 19 Jan 2012 17:40:00 +0100 From: Ulf Hansson To: , Chris Ball Cc: Adrian Hunter , Per Forlin , Ulf Hansson , Johan Rudholm , Lee Jones Subject: [PATCH 2/2] mmc: core: Detect card removal on I/O error Date: Thu, 19 Jan 2012 17:39:51 +0100 Message-ID: <1326991191-12472-3-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1326991191-12472-1-git-send-email-ulf.hansson@stericsson.com> References: <1326991191-12472-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 A card can be "slowly" removed which means that when a card detect irq has triggered a scheduled detect work to handle the card removal, the card will still be present in the card slot and thus not removed by the rescan sequence. To prevent further I/O request for these lingering "removed" cards, use MMC_CAP2_DETECT_ON_ERR which will check if card is still present from mmc_detect_card_removed function. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 3 ++- include/linux/mmc/host.h | 1 + 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 265dfd8..e5d1c3b 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2084,7 +2084,8 @@ int mmc_detect_card_removed(struct mmc_host *host) * The card will be considered unchanged unless we have been asked to * detect a change or host requires polling to provide card detection. */ - if (card && !host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL)) + if (card && !host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL) + && !(host->caps2 & MMC_CAP2_DETECT_ON_ERR)) return mmc_card_removed(card); ret = mmc_card_removed(card); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index dd13e05..368a2b9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -257,6 +257,7 @@ struct mmc_host { #define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ MMC_CAP2_HS200_1_2V_SDR) +#define MMC_CAP2_DETECT_ON_ERR (1 << 7) /* On I/O err check card removal */ mmc_pm_flag_t pm_caps; /* supported pm features */ unsigned int power_notify_type;