From patchwork Tue Aug 8 22:41:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 9889165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D997A601EB for ; Tue, 8 Aug 2017 22:41:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC8C328919 for ; Tue, 8 Aug 2017 22:41:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C16EF28A1D; Tue, 8 Aug 2017 22:41:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CFE428919 for ; Tue, 8 Aug 2017 22:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752158AbdHHWlt (ORCPT ); Tue, 8 Aug 2017 18:41:49 -0400 Received: from mga04.intel.com ([192.55.52.120]:7150 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752442AbdHHWlT (ORCPT ); Tue, 8 Aug 2017 18:41:19 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Aug 2017 15:41:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,345,1498546800"; d="scan'208";a="137931417" Received: from spandruv-desk.jf.intel.com ([10.54.75.11]) by fmsmga006.fm.intel.com with ESMTP; 08 Aug 2017 15:41:18 -0700 From: Srinivas Pandruvada To: rjw@rjwysocki.net, lenb@kernel.org Cc: linux-pm@vger.kernel.org, mario.limonciello@dell.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, lukas@wunner.de, Srinivas Pandruvada Subject: [PATCH v2 1/2] PM / sleep: Export the setting of pm_debug_messages_on Date: Tue, 8 Aug 2017 15:41:14 -0700 Message-Id: <1502232075-23832-2-git-send-email-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1502232075-23832-1-git-send-email-srinivas.pandruvada@linux.intel.com> References: <1502232075-23832-1-git-send-email-srinivas.pandruvada@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added a function to export the value of pm_debug_messages_on, so that other parts of the system can use this flag to enable/disable executing PM debug code. Signed-off-by: Srinivas Pandruvada --- include/linux/suspend.h | 6 ++++++ kernel/power/main.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 8c3b0b1..5d4b3a3 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -496,6 +496,10 @@ static inline void unlock_system_sleep(void) {} #ifdef CONFIG_PM_SLEEP_DEBUG extern bool pm_print_times_enabled; extern __printf(2, 3) void __pm_pr_dbg(bool defer, const char *fmt, ...); + +/* Return the value of pm_debug_messages_on */ +bool pm_debug_messages_enabled(void); + #else #define pm_print_times_enabled (false) @@ -503,6 +507,8 @@ extern __printf(2, 3) void __pm_pr_dbg(bool defer, const char *fmt, ...); #define __pm_pr_dbg(defer, fmt, ...) \ no_printk(KERN_DEBUG fmt, ##__VA_ARGS__) + +static inline bool pm_debug_messages_enabled(void) { return false; } #endif #define pm_pr_dbg(fmt, ...) \ diff --git a/kernel/power/main.c b/kernel/power/main.c index 3074ea4..afb7f00 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -363,6 +363,11 @@ power_attr_ro(pm_wakeup_irq); static bool pm_debug_messages_on __read_mostly; +bool pm_debug_messages_enabled(void) +{ + return pm_debug_messages_on; +} + static ssize_t pm_debug_messages_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) {