From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D8DEC33CAF for ; Thu, 16 Jan 2020 19:02:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 68D22206E6 for ; Thu, 16 Jan 2020 19:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579201327; bh=/iN5Lv/5xS6+NV97ObyRAfHsQdm5wUcuDcmt1iZWIz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lYcSDA81/qz1dxSqosoVLr3T9GtdBaS0Am1NykDHHBihGJrP8VMmPAzlRrBKjlyW7 FWgWfnhlJMYTGdhM5ssRhITG1/HGSPn2fi3Xqu5wAzhfwFdKxl6/ABMH4+Z4A+SaXo rV4pzJ1/VG04/5pKj5PJjK1qNqnvg0RYYgMIvAaE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390046AbgAPTB6 (ORCPT ); Thu, 16 Jan 2020 14:01:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:34998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388712AbgAPRFp (ORCPT ); Thu, 16 Jan 2020 12:05:45 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 20CBF205F4; Thu, 16 Jan 2020 17:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579194344; bh=/iN5Lv/5xS6+NV97ObyRAfHsQdm5wUcuDcmt1iZWIz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqqx47MhkPwf/LIZ9LtHMaba5k0eplb2MLFh6gh2RqRF5DEvk1lvakYlUdAFPujqc pHRW008HUgJoFwbn+4hzgDntVA7nDnCrDOFxmJeprWnEDieJdaPoFY3CWYT9v9rP6G X0F0cSrAByGSwG+izYy3zZbwEmt0CdRzUuOGtJFA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhang Rui , Zhao Lijian , "Rafael J . Wysocki" , Sasha Levin , linux-acpi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 286/671] ACPI: button: reinitialize button state upon resume Date: Thu, 16 Jan 2020 11:58:44 -0500 Message-Id: <20200116170509.12787-23-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116170509.12787-1-sashal@kernel.org> References: <20200116170509.12787-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Zhang Rui [ Upstream commit 13e962140be671f31a011543f11477af67a6c33e ] With commit dfa46c50f65b ("ACPI / button: Fix an issue in button.lid_init_state=ignore mode"), the lid device is considered to be not compliant to SW_LID if the Lid state is unchanged when updating it. This is not wrong, but we overlooked the resume case, where Lid state is updated unconditionally in the button driver .resume() callback. And this results in warning message "ACPI: button: The lid device is not compliant to SW_LID." after resume, if the machine is suspended with Lid opened and then resumed with Lid opened. Fix this by flushing the cached lid state before updating the Lid device in .resume() callback. Fixes: dfa46c50f65b ("ACPI / button: Fix an issue in button.lid_init_state=ignore mode") Reported-and-tested-by: Zhao Lijian Signed-off-by: Zhang Rui Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/button.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 870eb5c7516a..a25d77b3a16a 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -467,8 +467,11 @@ static int acpi_button_resume(struct device *dev) struct acpi_button *button = acpi_driver_data(device); button->suspended = false; - if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) + if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) { + button->last_state = !!acpi_lid_evaluate_state(device); + button->last_time = ktime_get(); acpi_lid_initialize_state(device); + } return 0; } #endif -- 2.20.1