From patchwork Thu Apr 7 08:56:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 8769821 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 598429FBEA for ; Thu, 7 Apr 2016 08:57:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 380DA20204 for ; Thu, 7 Apr 2016 08:57:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE59B201EC for ; Thu, 7 Apr 2016 08:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755260AbcDGI45 (ORCPT ); Thu, 7 Apr 2016 04:56:57 -0400 Received: from mail-lb0-f180.google.com ([209.85.217.180]:33350 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbcDGI4z (ORCPT ); Thu, 7 Apr 2016 04:56:55 -0400 Received: by mail-lb0-f180.google.com with SMTP id u8so45588324lbk.0 for ; Thu, 07 Apr 2016 01:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=xmqEc3t6d43VoDaxmUCvHUZ8slV0egpES3xJD8s9trg=; b=M++0m4IZkLNU8XhtjqZ+vGC8ec0dGLwl8GEleGBB7sNwj/NW5/vFERdLjERkRjuaWH rdQabUSJWCHIhQefzlMobSu4XFi8TyjrdI1Qk79tMMgQrVqxthd5UndqwmpM3LZK2fDl XHF1rsGabcOtVY/GKH68h31qY8Xz8+RAdpx7U= 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=xmqEc3t6d43VoDaxmUCvHUZ8slV0egpES3xJD8s9trg=; b=KEngj+PPcK+N5BpSBXSWmV+PlJj2Uq+GigjIT67RyYLM8c6NJd454yIfFhwVmPlU57 N3+HBYQ34tIIHe1Co3A+hMKUJflsv6QXQTqkwJkIUkjf4iYkUNpOksgGQOfv8UBDp6KL GAduKa+5xp37MKHklZA/AlVKO3Uu7sXitt2oBJ0YD70TCCZyJR54yVxDtXLm8PweHX7U CRevZ5tku6penu6fE988aFskmXR8CSTz+6n8Z8n9GP16BF618Xzr1FHoE3svMiiZSAK2 x20sWEhqPAAtESNjmis0OZV4k22btGYQ4yFTAYNJTMil8PtF3CVkTqXXN3a5goWIKfvg J4UA== X-Gm-Message-State: AD7BkJJdv3N93uDvLCzMjbKFm7g/kljdq8WJIntSkHqa7o9blRcuzKJABLN/og2REa1hnPpk X-Received: by 10.112.124.137 with SMTP id mi9mr885009lbb.112.1460019413545; Thu, 07 Apr 2016 01:56:53 -0700 (PDT) Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id lw1sm1060530lbc.15.2016.04.07.01.56.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Apr 2016 01:56:51 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Russell King Subject: [PATCH V2] mmc: sdhci: Remove redundant runtime PM calls Date: Thu, 7 Apr 2016 10:56:39 +0200 Message-Id: <1460019399-922-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host devices"), made some calls to the runtime PM API from the driver redundant. Especially those which deals with runtime PM reference counting, so let's remove them. Moreover as SDHCI have its own wrapper functions for runtime PM these becomes superfluous, so let's remove them as well. Signed-off-by: Ulf Hansson Acked-by: Adrian Hunter --- Changes in v2: - Remove also redundant runtime PM calls when enabling/disabling the SDIO IRQ. - Remove the Cc to Adrian as a part of the change log. --- drivers/mmc/host/sdhci.c | 55 ++++-------------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6bd3d17..8e74e75 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -56,19 +56,9 @@ static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable); static int sdhci_do_get_cd(struct sdhci_host *host); #ifdef CONFIG_PM -static int sdhci_runtime_pm_get(struct sdhci_host *host); -static int sdhci_runtime_pm_put(struct sdhci_host *host); static void sdhci_runtime_pm_bus_on(struct sdhci_host *host); static void sdhci_runtime_pm_bus_off(struct sdhci_host *host); #else -static inline int sdhci_runtime_pm_get(struct sdhci_host *host) -{ - return 0; -} -static inline int sdhci_runtime_pm_put(struct sdhci_host *host) -{ - return 0; -} static void sdhci_runtime_pm_bus_on(struct sdhci_host *host) { } @@ -1319,8 +1309,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) host = mmc_priv(mmc); - sdhci_runtime_pm_get(host); - /* Firstly check card presence */ present = mmc->ops->get_cd(mmc); @@ -1567,9 +1555,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct sdhci_host *host = mmc_priv(mmc); - sdhci_runtime_pm_get(host); sdhci_do_set_ios(host, ios); - sdhci_runtime_pm_put(host); } static int sdhci_do_get_cd(struct sdhci_host *host) @@ -1601,12 +1587,8 @@ static int sdhci_do_get_cd(struct sdhci_host *host) static int sdhci_get_cd(struct mmc_host *mmc) { struct sdhci_host *host = mmc_priv(mmc); - int ret; - sdhci_runtime_pm_get(host); - ret = sdhci_do_get_cd(host); - sdhci_runtime_pm_put(host); - return ret; + return sdhci_do_get_cd(host); } static int sdhci_check_ro(struct sdhci_host *host) @@ -1662,12 +1644,8 @@ static void sdhci_hw_reset(struct mmc_host *mmc) static int sdhci_get_ro(struct mmc_host *mmc) { struct sdhci_host *host = mmc_priv(mmc); - int ret; - sdhci_runtime_pm_get(host); - ret = sdhci_do_get_ro(host); - sdhci_runtime_pm_put(host); - return ret; + return sdhci_do_get_ro(host); } static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable) @@ -1689,8 +1667,6 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable) struct sdhci_host *host = mmc_priv(mmc); unsigned long flags; - sdhci_runtime_pm_get(host); - spin_lock_irqsave(&host->lock, flags); if (enable) host->flags |= SDHCI_SDIO_IRQ_ENABLED; @@ -1699,8 +1675,6 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable) sdhci_enable_sdio_irq_nolock(host, enable); spin_unlock_irqrestore(&host->lock, flags); - - sdhci_runtime_pm_put(host); } static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, @@ -1798,14 +1772,11 @@ static int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios) { struct sdhci_host *host = mmc_priv(mmc); - int err; if (host->version < SDHCI_SPEC_300) return 0; - sdhci_runtime_pm_get(host); - err = sdhci_do_start_signal_voltage_switch(host, ios); - sdhci_runtime_pm_put(host); - return err; + + return sdhci_do_start_signal_voltage_switch(host, ios); } static int sdhci_card_busy(struct mmc_host *mmc) @@ -1813,10 +1784,8 @@ static int sdhci_card_busy(struct mmc_host *mmc) struct sdhci_host *host = mmc_priv(mmc); u32 present_state; - sdhci_runtime_pm_get(host); /* Check whether DAT[3:0] is 0000 */ present_state = sdhci_readl(host, SDHCI_PRESENT_STATE); - sdhci_runtime_pm_put(host); return !(present_state & SDHCI_DATA_LVL_MASK); } @@ -1843,7 +1812,6 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) unsigned int tuning_count = 0; bool hs400_tuning; - sdhci_runtime_pm_get(host); spin_lock_irqsave(&host->lock, flags); hs400_tuning = host->flags & SDHCI_HS400_TUNING; @@ -1891,7 +1859,6 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) if (host->ops->platform_execute_tuning) { spin_unlock_irqrestore(&host->lock, flags); err = host->ops->platform_execute_tuning(host, opcode); - sdhci_runtime_pm_put(host); return err; } @@ -2023,8 +1990,6 @@ out: sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); out_unlock: spin_unlock_irqrestore(&host->lock, flags); - sdhci_runtime_pm_put(host); - return err; } @@ -2222,7 +2187,6 @@ static void sdhci_tasklet_finish(unsigned long param) spin_unlock_irqrestore(&host->lock, flags); mmc_request_done(host->mmc, mrq); - sdhci_runtime_pm_put(host); } static void sdhci_timeout_timer(unsigned long data) @@ -2703,17 +2667,6 @@ int sdhci_resume_host(struct sdhci_host *host) EXPORT_SYMBOL_GPL(sdhci_resume_host); -static int sdhci_runtime_pm_get(struct sdhci_host *host) -{ - return pm_runtime_get_sync(host->mmc->parent); -} - -static int sdhci_runtime_pm_put(struct sdhci_host *host) -{ - pm_runtime_mark_last_busy(host->mmc->parent); - return pm_runtime_put_autosuspend(host->mmc->parent); -} - static void sdhci_runtime_pm_bus_on(struct sdhci_host *host) { if (host->bus_on)