From patchwork Fri Sep 4 13:34:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 7123181 Return-Path: X-Original-To: patchwork-linux-pm@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 54E5E9F32B for ; Fri, 4 Sep 2015 13:41:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 725C2207CE for ; Fri, 4 Sep 2015 13:41:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 838202089D for ; Fri, 4 Sep 2015 13:41:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933825AbbIDNlb (ORCPT ); Fri, 4 Sep 2015 09:41:31 -0400 Received: from mail.bmw-carit.de ([62.245.222.98]:45858 "EHLO linuxmail.bmw-carit.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933822AbbIDNl3 (ORCPT ); Fri, 4 Sep 2015 09:41:29 -0400 Received: from localhost (handman.bmw-carit.intra [192.168.101.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linuxmail.bmw-carit.de (Postfix) with ESMTPS id 448E54007E; Fri, 4 Sep 2015 15:30:12 +0200 (CEST) From: Daniel Wagner To: linux-kernel@vger.kernel.org Cc: Daniel Wagner , "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Subject: [RFC v0 2/9] suspend: Add getter function to report if freezing is active Date: Fri, 4 Sep 2015 15:34:55 +0200 Message-Id: <1441373702-31796-3-git-send-email-daniel.wagner@bmw-carit.de> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1441373702-31796-1-git-send-email-daniel.wagner@bmw-carit.de> References: <1441373702-31796-1-git-send-email-daniel.wagner@bmw-carit.de> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Instead encode the FREEZE state via the CPU state we allow the interesting subsystems (MCE, microcode) to query the power subsystem directly. Most notifiers are not interested at all in this information so rather have explicit calls to freeze_active() instead adding complexity to the rest of the users of the CPU notifiers. Signed-off-by: Daniel Wagner Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Pavel Machek Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- include/linux/suspend.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 5efe743..5e15ade 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -216,6 +216,11 @@ static inline bool idle_should_freeze(void) return unlikely(suspend_freeze_state == FREEZE_STATE_ENTER); } +static inline bool freeze_active(void) +{ + return unlikely(suspend_freeze_state != FREEZE_STATE_NONE); +} + extern void freeze_set_ops(const struct platform_freeze_ops *ops); extern void freeze_wake(void); @@ -244,6 +249,7 @@ extern int pm_suspend(suspend_state_t state); static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } static inline bool idle_should_freeze(void) { return false; } +static inline bool freeze_active(void) { return false; } static inline void freeze_set_ops(const struct platform_freeze_ops *ops) {} static inline void freeze_wake(void) {} #endif /* !CONFIG_SUSPEND */