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: 7562201 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9ED439F4F5 for ; Thu, 5 Nov 2015 15:08:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB3302081F for ; Thu, 5 Nov 2015 15:08:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 317212085E for ; Thu, 5 Nov 2015 15:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161578AbbKEPIP (ORCPT ); Thu, 5 Nov 2015 10:08:15 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:35880 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161579AbbKEPIO (ORCPT ); Thu, 5 Nov 2015 10:08:14 -0500 Received: by lbblt2 with SMTP id lt2so18461414lbb.3 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=haCbC5LUZvsRUv+afx+xsWMqo3yR4GkGd9cHvwg4t3brU0qIaun2rCc6QIIY0wDQI4 gmRCXLCo9anM4PJIB+85W29s78N2LSj49qXIO9WvM1u4Nyotk762SWBo6UjhprIdwJss uv3KIX/0bYyk4l3qft9X2SBApWank+xy4twEBTuLNyT0gqQnRTGDeh+tXLwa4IeDu+FB goLqGaY9ryhB8RV/NFuBAdFZyJerHBARRcbkJoIjKccYaARDTCbSCix4GICQUX0RFIu7 QYiz2rfpEcvz7RJ0cw9BKXym7D03aOEEy72b3LBVFXvSe60XHek1Hv81jlgmxQrTnbVm OXgQ== X-Gm-Message-State: ALoCoQlMcfrToytaPUR1NS7ihuvCZQEXdeaGGPSkfYGyWPIxWNJox+K6UARuj6HbMHVpRF7U+uqh X-Received: by 10.112.129.161 with SMTP id nx1mr4033849lbb.112.1446736092472; Thu, 05 Nov 2015 07:08:12 -0800 (PST) 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;