From patchwork Thu Nov 5 15:21:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 56060 Delivered-To: patches@linaro.org Received: by 10.112.61.134 with SMTP id p6csp467700lbr; Thu, 5 Nov 2015 07:21:47 -0800 (PST) X-Received: by 10.112.129.6 with SMTP id ns6mr4055987lbb.109.1446736907471; Thu, 05 Nov 2015 07:21:47 -0800 (PST) Return-Path: Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com. [2a00:1450:4010:c07::22d]) by mx.google.com with ESMTPS id b19si2763843lfb.158.2015.11.05.07.21.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2015 07:21:47 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) client-ip=2a00:1450:4010:c07::22d; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Received: by lfs39 with SMTP id 39so29171169lfs.3 for ; Thu, 05 Nov 2015 07:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=OryjBVIAG4VQNmY9GehSE/b3zwxyXtJmDo1m+5d2Twk=; b=ok0KmTWgMelegBlYWe3U43U0u9AjwtW9gywNwgm+TEGLUlkoJeLtVg2Ef5h8muDhpN sT42IU45aRTvjBapq+UnVciQ2ibSMKDLAnDYOLll2UaJKXC9Q5UpPhUR9ncpHFjjBaNp Xu8hIuyIgKHmVjqaakg3CGxW+lNnWpWMhSTh6fx/32NjdeNRvghknWtGJNMYmqGiFj8P CKY3/WnmnCXPHSIMyyofx3qmol3JBKALhdicTPxEplSmiNzAZTX7qAOZiT++kWoWxaXA FDAwptV4UsRfhrRgby3OnJ50gchO6wqGfIkTOZm+RIoxDBO9yVGCP6LSpd2Mp7NvW8DG jMPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OryjBVIAG4VQNmY9GehSE/b3zwxyXtJmDo1m+5d2Twk=; b=jqE5STxFxfaDTGTlDuCQH+tX0nScDAYmCJfjGLXn7qSMB5c6wFIDF3dOVSJ4NncG/X qaXTzJ5TYGHkEAgO/mJwbjhKFGBepv2j/jDnah/YwU7C5HXwLVvgAOko54d1zw8h5rH2 LdpOkcjn1AvpYv4/aOsOyueK3WeMkqck0G/NhjQ8eJxaSMFxeeU7EY+7dz9btoThACOZ 7x1FijpPMz2FjfuQzD7hC/82SisglDMDl9rTLWpOOyOHyygoZySGzMaH33uOcWGUNym4 GzFoOkhngs2zCrXEsI73SuTuBAkzdN3xWGCKJ/rAFf2PBQFAnLRivBhIuKgVR9FEurE7 bJ5g== X-Gm-Message-State: ALoCoQl8YnlmU7vRlpIlLp/AAVkHShrk1UH7ue390Knod7PMNybLRqCGAVyMQ0Y6ANwHAc1FuDN2 X-Received: by 10.25.206.16 with SMTP id e16mr2304430lfg.39.1446736907298; Thu, 05 Nov 2015 07:21:47 -0800 (PST) Return-Path: Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f138sm1053720lfd.6.2015.11.05.07.21.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 07:21:46 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter Subject: [PATCH] mmc: core: Check for non-removable cards earlier in the error path Date: Thu, 5 Nov 2015 16:21:39 +0100 Message-Id: <1446736899-21542-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 _mmc_detect_card_removed() validates that the card is removable, but when being called via the bus_ops ->detect() callbacks, the validation is redundant as it's already done in mmc_rescan(). Move the validation of a removable card to the mmc_detect_card_removed() API, which is where it's applicable, to allow the blk error recovery path to get the response a bit earlier. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5ae89e4..34243f7 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2498,9 +2498,6 @@ int _mmc_detect_card_removed(struct mmc_host *host) { int ret; - if (host->caps & MMC_CAP_NONREMOVABLE) - return 0; - if (!host->card || mmc_card_removed(host->card)) return 1; @@ -2536,6 +2533,9 @@ int mmc_detect_card_removed(struct mmc_host *host) if (!card) return 1; + if (host->caps & MMC_CAP_NONREMOVABLE) + return 0; + ret = mmc_card_removed(card); /* * The card will be considered unchanged unless we have been asked to