From patchwork Mon Jul 11 22:51:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 966732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6BMorVf022834 for ; Mon, 11 Jul 2011 22:51:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758301Ab1GKWv0 (ORCPT ); Mon, 11 Jul 2011 18:51:26 -0400 Received: from na3sys009aog109.obsmtp.com ([74.125.149.201]:48334 "EHLO na3sys009aog109.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758147Ab1GKWv0 (ORCPT ); Mon, 11 Jul 2011 18:51:26 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]) (using TLSv1) by na3sys009aob109.postini.com ([74.125.148.12]) with SMTP ID DSNKTht+bRuvIgaZzleBGp8URNSAdSJD10Sw@postini.com; Mon, 11 Jul 2011 15:51:26 PDT Received: by mail-iy0-f173.google.com with SMTP id 3so5023411iyb.32 for ; Mon, 11 Jul 2011 15:51:25 -0700 (PDT) Received: by 10.42.144.6 with SMTP id z6mr5826631icu.483.1310424685107; Mon, 11 Jul 2011 15:51:25 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net [24.19.7.36]) by mx.google.com with ESMTPS id v3sm992332ibh.33.2011.07.11.15.51.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jul 2011 15:51:24 -0700 (PDT) From: Kevin Hilman To: "Rafael J. Wysocki" , linux-pm@lists.linux-foundation.org Cc: linux-omap@vger.kernel.org Subject: [PATCH] PM / Runtime: add new helper function: pm_runtime_status_suspended() Date: Mon, 11 Jul 2011 15:51:22 -0700 Message-Id: <1310424682-21255-1-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.6 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 11 Jul 2011 22:51:27 +0000 (UTC) This boolean function simply returns whether or not the runtime status of the device is 'suspended'. Unlike pm_runtime_suspended(), this function returns the runtime status whether or not runtime PM for the device has been disabled or not. Also add entry to Documentation/power/runtime.txt Suggested-by: Rafael J. Wysocki Signed-off-by: Kevin Hilman --- Documentation/power/runtime_pm.txt | 3 +++ include/linux/pm_runtime.h | 6 ++++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 4b011b1..feca92f 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt @@ -400,6 +400,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: - return true if the device's runtime PM status is 'suspended' and its 'power.disable_depth' field is equal to zero, or false otherwise + bool pm_runtime_status_suspended(struct device *dev); + - return true if the device's runtime PM status is 'suspended' + void pm_runtime_allow(struct device *dev); - set the power.runtime_auto flag for the device and decrease its usage counter (used by the /sys/devices/.../power/control interface to diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index dfb8539..daac05d 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -82,6 +82,11 @@ static inline bool pm_runtime_suspended(struct device *dev) && !dev->power.disable_depth; } +static inline bool pm_runtime_status_suspended(struct device *dev) +{ + return dev->power.runtime_status == RPM_SUSPENDED; +} + static inline bool pm_runtime_enabled(struct device *dev) { return !dev->power.disable_depth; @@ -130,6 +135,7 @@ static inline void pm_runtime_put_noidle(struct device *dev) {} static inline bool device_run_wake(struct device *dev) { return false; } static inline void device_set_run_wake(struct device *dev, bool enable) {} static inline bool pm_runtime_suspended(struct device *dev) { return false; } +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_idle(struct device *dev) { return 0; }