From patchwork Fri Dec 19 09:45:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 42481 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B871026C68 for ; Fri, 19 Dec 2014 09:45:50 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf402224lab.4 for ; Fri, 19 Dec 2014 01:45:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=NpFnhLEUV0W5WnNcpXaZmDgjNxxVSyEOPYRkE4bQwOE=; b=WfZQS/VKdjXWx/ORrClV/aAl1STpyic1qdVsMvBySYFILN5FaVeFo8lsrX7z8Yc476 Nolz0eJAZvgWZ2UV+/YYmD4076XkNAINEm/GgncA/Ynu5Almvj+AWoBRReNKB3QuVz/W rMJnnPEs4i4TxONURgv5UON1vawy0/i3gM0BCq1QSV2CqO10hZ8ozZxyn5OjZPQ7+gU4 DXOXRk4+pp4P2gE1J6v5QA9BXMmvKa9ydsw081KsF/WQjzgDPAE9RKSVP+6pyZSm54vI Nk4JoRoaaOsF6d601RXKk0szn3mBOFjUIfDCJfJ2kgXmiruk7EhkaOoMAv4t5QSICFPi 09IA== X-Gm-Message-State: ALoCoQmij2l0Az4fDvupVPegDHxAYnrP4mMGRthKrl0qLnMOiQi5Qi2MZaeK8VnJsT/yU4lw5X/q X-Received: by 10.112.147.195 with SMTP id tm3mr14951lbb.18.1418982349375; Fri, 19 Dec 2014 01:45:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.167 with SMTP id g7ls1103851lae.62.gmail; Fri, 19 Dec 2014 01:45:49 -0800 (PST) X-Received: by 10.112.235.137 with SMTP id um9mr6857710lbc.41.1418982348976; Fri, 19 Dec 2014 01:45:48 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id j4si9494073lbd.15.2014.12.19.01.45.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 01:45:48 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id gq15so524531lab.18 for ; Fri, 19 Dec 2014 01:45:48 -0800 (PST) X-Received: by 10.112.136.69 with SMTP id py5mr6723552lbb.56.1418982348862; Fri, 19 Dec 2014 01:45:48 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp211854lbb; Fri, 19 Dec 2014 01:45:48 -0800 (PST) X-Received: by 10.152.1.201 with SMTP id 9mr6904446lao.36.1418982348322; Fri, 19 Dec 2014 01:45:48 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id w4si8070153law.77.2014.12.19.01.45.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 01:45:48 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id u10so503033lbd.6 for ; Fri, 19 Dec 2014 01:45:48 -0800 (PST) X-Received: by 10.112.27.133 with SMTP id t5mr6850957lbg.45.1418982348151; Fri, 19 Dec 2014 01:45:48 -0800 (PST) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id is5sm2561022lac.41.2014.12.19.01.45.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Dec 2014 01:45:47 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Chris Ball Cc: Dong Aisheng , Shawn Guo Subject: [PATCH 1/2] mmc: sdhci-esdhc-imx: Fixup ->remove() Date: Fri, 19 Dec 2014 10:45:43 +0100 Message-Id: <1418982343-8023-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <0002-mmc-sdhci-esdhc-imx-Fixup-runtime-PM-conditions-duri.patch> References: <0002-mmc-sdhci-esdhc-imx-Fixup-runtime-PM-conditions-duri.patch> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Since sdhci_remove_host() access the device, we need to make sure it's runtime PM resumed. To handle clock gating properly in remove, we first have to make sure the clocks are ungated. To fix both these issues, by invoking pm_runtime_get_sync() early in ->remove() callback. Later once we disabled runtime PM, we can restore the usage count. Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci-esdhc-imx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index af1f7c0..043866c 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1103,16 +1103,15 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev) struct pltfm_imx_data *imx_data = pltfm_host->priv; int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); - sdhci_remove_host(host, dead); - - pm_runtime_dont_use_autosuspend(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); - if (!IS_ENABLED(CONFIG_PM)) { - clk_disable_unprepare(imx_data->clk_per); - clk_disable_unprepare(imx_data->clk_ipg); - clk_disable_unprepare(imx_data->clk_ahb); - } + sdhci_remove_host(host, dead); + + clk_disable_unprepare(imx_data->clk_per); + clk_disable_unprepare(imx_data->clk_ipg); + clk_disable_unprepare(imx_data->clk_ahb); sdhci_pltfm_free(pdev);