From patchwork Tue Mar 29 07:31:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 64579 Delivered-To: patches@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1854043lbc; Tue, 29 Mar 2016 00:31:44 -0700 (PDT) X-Received: by 10.112.201.133 with SMTP id ka5mr387072lbc.1.1459236692031; Tue, 29 Mar 2016 00:31:32 -0700 (PDT) Return-Path: Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com. [2a00:1450:4010:c07::231]) by mx.google.com with ESMTPS id e76si1766334lfi.168.2016.03.29.00.31.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Mar 2016 00:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::231 as permitted sender) client-ip=2a00:1450:4010:c07::231; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::231 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org Received: by mail-lf0-x231.google.com with SMTP id g124so3035658lfg.0 for ; Tue, 29 Mar 2016 00:31:32 -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:in-reply-to:references; bh=NeJ593nGhwlEN17SqJMbd/UZjBIO8tbf6NN1NMciiQw=; b=iYQyp5ApAatb/M3Bn8g3DjZrblgL+4mxj8AbVUoVKWHPFIBaop1gQt+ViscZh5HPvp QfxqjHsWnotJBPcVVZx6NjXU6/NSw0FvM+t3T5+IT46lfdhS4LGna1TKReW91hIRbFDX YHto+PtlFarDCyKE8QMd3lWSObN6KhUH40xJg= 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:in-reply-to :references; bh=NeJ593nGhwlEN17SqJMbd/UZjBIO8tbf6NN1NMciiQw=; b=mcVitnU5rrLw4Qlv5oxtzCjwqU75EUsNiDxRM9CMWx+U0o66u29Wz6jrTrtb9xNcdP 3cNntcCMjhXqbywbVwd88SKfMEgDY4L+z5gjAGNayPnFFFJ4XQd1VSszigt5f+cedZk8 3YuUCP/jZ5CKdJAOrRBs8lxTpkHUGqIr5arcuSwxcI5jTz94AMRCz1ZhzbKlK/gHVbgu B2E6/ByaGaPus9C2sCHUtTEd7sLGowcN85A2D6mMdNAWDKtoeHVXxwIMQplp3TCjIvmH uWDcdb3WUdHIFNGVCapTOBQNcBsYgiJkR1HM9Sb1IoreRstF0oPkwVn8zQ+RKYVJpJcz RRWg== X-Gm-Message-State: AD7BkJKtPzmDjN860jBoM7T1gn/KTcEhMC0BMHRdTkFhfi4gGPb8uXHyZs4DnsLjDh49F7iVzsg= X-Received: by 10.25.32.5 with SMTP id g5mr394104lfg.19.1459236691896; Tue, 29 Mar 2016 00:31:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-83-233-167-104.cust.bredband2.com. [83.233.167.104]) by smtp.gmail.com with ESMTPSA id qh4sm5033100lbb.43.2016.03.29.00.31.30 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Mar 2016 00:31:30 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter Subject: [PATCH 7/8] mmc: sdhci: Remove redundant runtime PM calls Date: Tue, 29 Mar 2016 09:31:12 +0200 Message-Id: <1459236673-5639-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459236673-5639-1-git-send-email-ulf.hansson@linaro.org> References: <1459236673-5639-1-git-send-email-ulf.hansson@linaro.org> 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. Cc: Adrian Hunter Signed-off-by: Ulf Hansson --- drivers/mmc/host/sdhci.c | 56 ++++++------------------------------------------ 1 file changed, 7 insertions(+), 49 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 8670f16..4bb9bfd 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) { } @@ -1298,8 +1288,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); @@ -1546,9 +1534,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) @@ -1580,12 +1566,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) @@ -1641,12 +1623,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) @@ -1668,7 +1646,7 @@ 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); + pm_runtime_get_sync(mmc_dev(mmc)); spin_lock_irqsave(&host->lock, flags); if (enable) @@ -1679,7 +1657,8 @@ 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); + pm_runtime_mark_last_busy(mmc_dev(mmc)); + pm_runtime_put_autosuspend(mmc_dev(mmc)); } static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, @@ -1777,14 +1756,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) @@ -1792,10 +1768,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); } @@ -1822,7 +1796,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; @@ -1870,7 +1843,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; } @@ -2002,8 +1974,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; } @@ -2201,7 +2171,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) @@ -2682,17 +2651,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)