From patchwork Tue Nov 26 23:49:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21785 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED720202E0 for ; Tue, 26 Nov 2013 23:49:48 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id x8sf14109651vbf.1 for ; Tue, 26 Nov 2013 15:49:48 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=bECDEL6AA9rcqQ6KWGreI56/wBOLBIAg7BxavsTD7Vo=; b=Rr+3bDRQpdSE7A4j/2R5M7ppe1CHVqWmQTPbDuVI+BVqh7JCE3TlFiH9mmEwlG2ZnY iX2VmiSkAECb+JbO84SwF2+1w3hIl3yMMnzy/I0iIDD7e7D/BH/W1YTwyg9IZbK6llZu iHwbc9obGi1Qd2qDaFe02PFYmfacZSf9TxN9rOwK8STiPOanEoW7DnxL/5db3cTRZmYH 00HyC0+wZttuxOAs/RJuTCYMEq2SSE+jhFF+YFbuaaDBXcPcazm2TjpkFfhlOv+qSw12 SaLJ9/wdtR4TBME1D8IqwXigeIMz4qENxHekW2b3l1X1PJmg3mOc7A2HAfV8+Hm6ekfY EIpQ== X-Gm-Message-State: ALoCoQlEVUSorbb0u2m0YdybUYxHcdzki2tm5NHe9hN8GJhH9Z47fOVFtRLxyCvTDWmqhBhmc3Qd X-Received: by 10.58.112.195 with SMTP id is3mr12330208veb.29.1385509788274; Tue, 26 Nov 2013 15:49:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.128.200 with SMTP id nq8ls2779713qeb.95.gmail; Tue, 26 Nov 2013 15:49:48 -0800 (PST) X-Received: by 10.52.165.131 with SMTP id yy3mr7425474vdb.25.1385509788061; Tue, 26 Nov 2013 15:49:48 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id dp3si20191856vcb.21.2013.11.26.15.49.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 15:49:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db12so4457226veb.8 for ; Tue, 26 Nov 2013 15:49:48 -0800 (PST) X-Received: by 10.220.86.69 with SMTP id r5mr32241589vcl.9.1385509787977; Tue, 26 Nov 2013 15:49:47 -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.220.174.196 with SMTP id u4csp246059vcz; Tue, 26 Nov 2013 15:49:47 -0800 (PST) X-Received: by 10.152.244.130 with SMTP id xg2mr28226497lac.4.1385509786878; Tue, 26 Nov 2013 15:49:46 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id y9si646787laa.10.2013.11.26.15.49.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 15:49:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.177 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id w7so4857572lbi.8 for ; Tue, 26 Nov 2013 15:49:46 -0800 (PST) X-Received: by 10.112.151.42 with SMTP id un10mr26759068lbb.7.1385509786197; Tue, 26 Nov 2013 15:49:46 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id ox6sm16070997lbb.6.2013.11.26.15.49.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 15:49:45 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, Ulf Hansson , Kevin Hilman , Alan Stern Subject: [PATCH] PM / Runtime: Implement the pm_generic_runtime functions for CONFIG_PM Date: Wed, 27 Nov 2013 00:49:41 +0100 Message-Id: <1385509781-18721-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , The pm_generic_runtime_suspend|resume functions were implemented within CONFIG_PM_RUNTIME. As we also may use runtime PM callbacks during system suspend, to put devices into low power state, we need to move the implementation of pm_generic_runtime_suspend|resume to CONFIG_PM. This change prevents the platform bus from by-passing driver's runtime PM callbacks while only CONFIG_PM_SLEEP and not CONFIG_PM_RUNTIME is being used. Cc: Kevin Hilman Cc: Alan Stern Signed-off-by: Ulf Hansson --- drivers/base/power/generic_ops.c | 4 ++-- include/linux/pm_runtime.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c index 5ee030a..a2e55bf 100644 --- a/drivers/base/power/generic_ops.c +++ b/drivers/base/power/generic_ops.c @@ -10,7 +10,7 @@ #include #include -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM /** * pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems. * @dev: Device to suspend. @@ -48,7 +48,7 @@ int pm_generic_runtime_resume(struct device *dev) return ret; } EXPORT_SYMBOL_GPL(pm_generic_runtime_resume); -#endif /* CONFIG_PM_RUNTIME */ +#endif /* CONFIG_PM */ #ifdef CONFIG_PM_SLEEP /** diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 6fa7cea..16c9a62 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -23,6 +23,14 @@ usage_count */ #define RPM_AUTO 0x08 /* Use autosuspend_delay */ +#ifdef CONFIG_PM +extern int pm_generic_runtime_suspend(struct device *dev); +extern int pm_generic_runtime_resume(struct device *dev); +#else +static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } +static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } +#endif + #ifdef CONFIG_PM_RUNTIME extern struct workqueue_struct *pm_wq; @@ -37,8 +45,6 @@ extern void pm_runtime_enable(struct device *dev); extern void __pm_runtime_disable(struct device *dev, bool check_resume); extern void pm_runtime_allow(struct device *dev); extern void pm_runtime_forbid(struct device *dev); -extern int pm_generic_runtime_suspend(struct device *dev); -extern int pm_generic_runtime_resume(struct device *dev); extern void pm_runtime_no_callbacks(struct device *dev); extern void pm_runtime_irq_safe(struct device *dev); extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); @@ -142,8 +148,6 @@ static inline bool pm_runtime_active(struct device *dev) { return true; } static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } static inline bool pm_runtime_enabled(struct device *dev) { return false; } -static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } -static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } static inline void pm_runtime_no_callbacks(struct device *dev) {} static inline void pm_runtime_irq_safe(struct device *dev) {}