From patchwork Sun Aug 12 10:50:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 10563633 X-Patchwork-Delegate: rjw@sisk.pl 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 C52A814E2 for ; Sun, 12 Aug 2018 10:52:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B822D297B1 for ; Sun, 12 Aug 2018 10:52:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC030297B5; Sun, 12 Aug 2018 10:52:25 +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=unavailable 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 5E5E5297B1 for ; Sun, 12 Aug 2018 10:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbeHLN34 (ORCPT ); Sun, 12 Aug 2018 09:29:56 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:50939 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728065AbeHLN34 (ORCPT ); Sun, 12 Aug 2018 09:29:56 -0400 Received: from 79.184.254.66.ipv4.supernova.orange.pl (79.184.254.66) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id fd5b4c1f0c3bc93f; Sun, 12 Aug 2018 12:52:16 +0200 From: "Rafael J. Wysocki" To: Linux ACPI Cc: Paul Menzel , Linux PM , LKML , Erik Schmauss Subject: [PATCH] ACPICA: Clear status of all events when entering sleep states Date: Sun, 12 Aug 2018 12:50:09 +0200 Message-ID: <1764673.ub23GCSM6t@aspire.rjw.lan> 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 Commit fa85015c0d95 (ACPICA: Clear status of all events when entering S5) made the sleep state entry code in ACPICA clear the status of all ACPI events when entering S5 to fix a functional regression reported against commit 18996f2db918 (ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume). However, it is reported now that the regression also affects system states other than S5 on some systems and causes them to wake up from sleep prematurely. For this reason, make the code in question clear the status of all ACPI events when entering all sleep states (in addition to S5) to avoid the premature wakeups (this may cause some wakeup events to be missed in theory, but the likelihood of that is small and the change here simply restores the previous behavior of the code). Fixes: 18996f2db918 (ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume) Reported-by: Paul Menzel Tested-by: Paul Menzel Cc: 4.17+ # 4.17+: fa85015c0d95 ACPICA: Clear status ... Signed-off-by: Rafael J. Wysocki --- drivers/acpi/acpica/hwsleep.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) Index: linux-pm/drivers/acpi/acpica/hwsleep.c =================================================================== --- linux-pm.orig/drivers/acpi/acpica/hwsleep.c +++ linux-pm/drivers/acpi/acpica/hwsleep.c @@ -56,14 +56,9 @@ acpi_status acpi_hw_legacy_sleep(u8 slee if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - /* - * If the target sleep state is S5, clear all GPEs and fixed events too - */ - if (sleep_state == ACPI_STATE_S5) { - status = acpi_hw_clear_acpi_status(); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + status = acpi_hw_clear_acpi_status(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } acpi_gbl_system_awake_and_running = FALSE;