From patchwork Thu Nov 5 15:08:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 56058 Delivered-To: patches@linaro.org Received: by 10.112.61.134 with SMTP id p6csp459132lbr; Thu, 5 Nov 2015 07:08:12 -0800 (PST) X-Received: by 10.112.190.99 with SMTP id gp3mr3986328lbc.117.1446736092645; Thu, 05 Nov 2015 07:08:12 -0800 (PST) Return-Path: Received: from mail-lb0-x231.google.com (mail-lb0-x231.google.com. [2a00:1450:4010:c04::231]) by mx.google.com with ESMTPS id o15si4610287lfo.97.2015.11.05.07.08.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2015 07:08:12 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c04::231 as permitted sender) client-ip=2a00:1450:4010:c04::231; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c04::231 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Received: by lbbkw15 with SMTP id kw15so31579248lbb.0 for ; Thu, 05 Nov 2015 07:08:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=rhifnhbQVlO6zu3I8R57xtkWWtxESpod6NdqjpNJCsA=; b=xHHLF6ziJOKEKlKB4kn7UuqmsoHUGySa9Xq5x2CS0LRFN0FKKTup83wsFJjJy3+k/X CsTwXNg0SSEEIRQGpx7pEP6G6SQeOr35f3lupLno3oPf56ZHyohOGq2Pf3sroaPuzcxk voNT5DMKdfcksiGrY20NB2QGim8JxCKjzO9ZpX5JZCn1GZUeGBa+21oDXgFLmgOBSQXa 04mEzyjBts4bAF8nZPAxtH7P/B2HCeF6RPOYxjsGcCaI1FQcAvrJxJ2KDDQYSu7zBBju au1M7TFiB41FGjSx3FqLoWjNCYBiZ4aLdrEdWOVvju7bSLiMxP2nysmbEcc6gvsS/W7/ RSVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=rhifnhbQVlO6zu3I8R57xtkWWtxESpod6NdqjpNJCsA=; b=JBjhWbd+59pNr4BbCKawLhtuNWlsoPD2eDMC/Jbu0r57wBeQdlz2FQtbMAr7ddbpxX xsZgLiMpDZxfDJSrSbJVr22nHOjvUsTcD7FIUZCXvoAnjdZtQefQaGQ6Im+rwOJKuLFF tlYTAEUZxV8BXJF66WRam0PF8hJHvIYO3IHkIoJ/eK41Il8wVC4/acqWlDXCVf5Tg54d IQcapl6I6TL8hK81rJBlmsEElRxeILk0Od9e2cAv2ttfot3LS6ngp+Remq1BEWktpzYS D3JFhmJW/5aq9yXKKojCnPg05+0iwtHExXtq+q/mQ8StIZpoJDVyqL0q9hRQW8umsfe+ ACNQ== X-Gm-Message-State: ALoCoQmCqZpG7mZSXoEm+oIar0lm18Vk4ZHMnGawTbm1uGe1YQQ3znzZn04Hi0M1I94imejSHpWK X-Received: by 10.112.129.161 with SMTP id nx1mr4033849lbb.112.1446736092472; Thu, 05 Nov 2015 07:08:12 -0800 (PST) Return-Path: Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f198sm1044405lff.9.2015.11.05.07.08.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 07:08:11 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Subject: [PATCH 2/2] mmc: core: Keep host claimed in mmc_rescan() while calling host ops Date: Thu, 5 Nov 2015 16:08:08 +0100 Message-Id: <1446736088-11715-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446736088-11715-1-git-send-email-ulf.hansson@linaro.org> References: <1446736088-11715-1-git-send-email-ulf.hansson@linaro.org> As mmc_claim_host() invokes pm_runtime_get_sync() for the mmc host device, it's important that the host is kept claimed for *all* accesses to it via the host_ops callbacks. In mmc_rescan(), the ->card_event() and the ->get_cd() callback are being invoked without claiming the host, let's fix this. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index c1027a4..394963d 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2576,7 +2576,9 @@ void mmc_rescan(struct work_struct *work) host->rescan_entered = 1; if (host->trigger_card_event && host->ops->card_event) { + mmc_claim_host(host); host->ops->card_event(host); + mmc_release_host(host); host->trigger_card_event = false; } @@ -2611,15 +2613,14 @@ void mmc_rescan(struct work_struct *work) */ mmc_bus_put(host); + mmc_claim_host(host); if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->get_cd && host->ops->get_cd(host) == 0) { - mmc_claim_host(host); mmc_power_off(host); mmc_release_host(host); goto out; } - mmc_claim_host(host); for (i = 0; i < ARRAY_SIZE(freqs); i++) { if (!mmc_rescan_try_freq(host, max(freqs[i], host->f_min))) break;