From patchwork Tue Jul 16 16:12:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 11046429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C00901800 for ; Tue, 16 Jul 2019 16:27:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA711285A7 for ; Tue, 16 Jul 2019 16:27:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E185285E3; Tue, 16 Jul 2019 16:27:42 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 DEC82285BD for ; Tue, 16 Jul 2019 16:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388194AbfGPQ1e (ORCPT ); Tue, 16 Jul 2019 12:27:34 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:61836 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387958AbfGPQ1T (ORCPT ); Tue, 16 Jul 2019 12:27:19 -0400 Received: from 79.184.255.39.ipv4.supernova.orange.pl (79.184.255.39) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.267) id e17e7cc6a5295d67; Tue, 16 Jul 2019 18:27:16 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Linux ACPI , LKML , Len Brown , Srinivas Pandruvada , Thomas Gleixner , Rajneesh Bhardwaj , "David E. Box" Subject: [PATCH 3/8] ACPI: EC: Return bool from acpi_ec_dispatch_gpe() Date: Tue, 16 Jul 2019 18:12:59 +0200 Message-ID: <4778086.90p4OrCUAx@kreacher> In-Reply-To: <71085220.z6FKkvYQPX@kreacher> References: <71085220.z6FKkvYQPX@kreacher> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki On some systems, if suspend-to-idle is used, the EC may singal system wakeup events (power button events, for example) as well as events that should not cause the system to resume and acpi_ec_dispatch_gpe() needs to be called to determine whether or not the system should resume then. In particular, if acpi_ec_dispatch_gpe() doesn't detect any EC events at all, the system should remain suspended, so it is useful to know when that is the case. For this reason, make acpi_ec_dispatch_gpe() return a bool value indicating whether or not any EC events have been detected by it. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/ec.c | 11 ++++++++--- drivers/acpi/internal.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) Index: linux-pm/drivers/acpi/ec.c =================================================================== --- linux-pm.orig/drivers/acpi/ec.c +++ linux-pm/drivers/acpi/ec.c @@ -1060,10 +1060,15 @@ void acpi_ec_set_gpe_wake_mask(u8 action acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action); } -void acpi_ec_dispatch_gpe(void) +bool acpi_ec_dispatch_gpe(void) { - if (first_ec) - acpi_dispatch_gpe(NULL, first_ec->gpe); + u32 ret; + + if (!first_ec) + return false; + + ret = acpi_dispatch_gpe(NULL, first_ec->gpe); + return ret == ACPI_INTERRUPT_HANDLED; } /* -------------------------------------------------------------------------- Index: linux-pm/drivers/acpi/internal.h =================================================================== --- linux-pm.orig/drivers/acpi/internal.h +++ linux-pm/drivers/acpi/internal.h @@ -196,7 +196,7 @@ void acpi_ec_block_transactions(void); void acpi_ec_unblock_transactions(void); void acpi_ec_mark_gpe_for_wake(void); void acpi_ec_set_gpe_wake_mask(u8 action); -void acpi_ec_dispatch_gpe(void); +bool acpi_ec_dispatch_gpe(void); int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, acpi_handle handle, acpi_ec_query_func func, void *data);