Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2030726imm; Thu, 21 Jun 2018 06:14:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKpLkxlBnc0rONs162CbH8QTFuL1LTFdFxZbaN187y3nr+0KmLLyRQvU6RCErLkPqUgTCwC X-Received: by 2002:a65:410d:: with SMTP id w13-v6mr1542343pgp.414.1529586856311; Thu, 21 Jun 2018 06:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529586856; cv=none; d=google.com; s=arc-20160816; b=lCWhAXlTeikK2f+4rclYfOsmY0IOprbzU3zB1vPoYApnVim+aCjTnrPllUIowI+hgY JBHnf7EGkQE33uXB886p8VzXMZAL83XmVoQUITZI+gm4dfe+knhVVTQOeEvVeews2x3x 0vQ3YS/AFs8dIrbiWrp/ksOw3FeBjAHA6XYFVnN+F5GQYyfzJSBeG+8LS744BE2Hn1Lb RuFi0miORXOIds/0UVjldj6jqhF38/cgqP9VIFFP7VFcx+qezCaiYJiyfuc89wkyoYY0 7HSYLaizi6lvLb/oeDNcRn7mwC6sEZhFpQa1Dm/FxpYLcwCqRI9dbxgS+ph8dKXG2KKd 13PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1NNeml+C/rgqHlEg81G73hWk081SP533CbbYm7THZUY=; b=TdsXdil7kOhXuZuGIcj/nAxwFffCufyEKNEwqZiYkezGhV9ZYg1FsADmBTY3s1lzSP oDmthSRELHBB8+pLLVqeIlSt7JMqZ8Y+bcBdEXRYapWIworNnB9W1D1nufh3AOHoM6Wu OZmTMcJ3qeUC7FbNEEUxFUXapwM0GxUlkWE10H2ofmrWtvh1InZxBjwIJ7Kn0tHldeX6 ak1poN3ACO7LPAeoM9Dn6JpLhopMCdImzthIPAzl9W7vo7XUMRKrkO+mnHVH2g7spddc huZEi5CzZSpo5NvW2jPqCjO05zKQLJohlUCl/xMVnArhIp6YTwE/285XohOQMNf8mpXW SY3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x66-v6si5082559pfx.67.2018.06.21.06.14.01; Thu, 21 Jun 2018 06:14:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932677AbeFUNMO (ORCPT + 99 others); Thu, 21 Jun 2018 09:12:14 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:46128 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbeFUNMN (ORCPT ); Thu, 21 Jun 2018 09:12:13 -0400 Received: from 79.184.254.22.ipv4.supernova.orange.pl (79.184.254.22) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id c8e7fd08c0638708; Thu, 21 Jun 2018 15:12:11 +0200 From: "Rafael J. Wysocki" To: Ravi Chandra Sadineni Cc: Ravi Chandra Sadineni , Len Brown , Dmitry Torokhov , Todd Broch , Linux Kernel Mailing List , ACPI Devel Maling List , Rajat Jain , Benson Leung , Furquan Shaikh Subject: Re: [PATCH V2] ACPI LID: increment wakeup count only when notified. Date: Thu, 21 Jun 2018 15:11:00 +0200 Message-ID: <1626382.ruNcc2KUiW@aspire.rjw.lan> In-Reply-To: References: <20180611175759.181681-1-ravisadineni@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, June 20, 2018 5:45:50 PM CEST Ravi Chandra Sadineni wrote: > Hi Rafael, > > Is this good to be merged ? Not for 4.18, so please give me some time here. > If you see any problem with the patch, can you > please let me know. I will. Thanks, Rafael > On Mon, Jun 11, 2018 at 10:57 AM, Ravi Chandra Sadineni < > ravisadineni@chromium.org> wrote: > > > Currently ACPI LID increments wakeup count irrespective of the wake source. > > This is because we call acpi_lid_initialize_state on every resume. > > Userland deamons using wakeup_count to identify the potential wake > > source for the last wake will be thrown off by this. Instead increment > > the wakeup count only when there is a FIXED_HARDWARE/NOTFIY_STATUS event. > > > > Signed-off-by: Ravi Chandra Sadineni > > --- > > V2: Increment the wakeup count only when the lid is open. > > > > drivers/acpi/button.c | 13 +++++++------ > > 1 file changed, 7 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c > > index 2345a5ee2dbbc..d2fe03e4faf05 100644 > > --- a/drivers/acpi/button.c > > +++ b/drivers/acpi/button.c > > @@ -235,9 +235,6 @@ static int acpi_lid_notify_state(struct acpi_device > > *device, int state) > > button->last_time = ktime_get(); > > } > > > > - if (state) > > - acpi_pm_wakeup_event(&device->dev); > > - > > ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, > > device); > > if (ret == NOTIFY_DONE) > > ret = blocking_notifier_call_chain(&acpi_lid_notifier, > > state, > > @@ -366,7 +363,8 @@ int acpi_lid_open(void) > > } > > EXPORT_SYMBOL(acpi_lid_open); > > > > -static int acpi_lid_update_state(struct acpi_device *device) > > +static int acpi_lid_update_state(struct acpi_device *device, > > + bool is_notification) > > { > > int state; > > > > @@ -374,6 +372,9 @@ static int acpi_lid_update_state(struct acpi_device > > *device) > > if (state < 0) > > return state; > > > > + if (state && is_notification) > > + acpi_pm_wakeup_event(&device->dev); > > + > > return acpi_lid_notify_state(device, state); > > } > > > > @@ -384,7 +385,7 @@ static void acpi_lid_initialize_state(struct > > acpi_device *device) > > (void)acpi_lid_notify_state(device, 1); > > break; > > case ACPI_BUTTON_LID_INIT_METHOD: > > - (void)acpi_lid_update_state(device); > > + (void)acpi_lid_update_state(device, false); > > break; > > case ACPI_BUTTON_LID_INIT_IGNORE: > > default: > > @@ -409,7 +410,7 @@ static void acpi_button_notify(struct acpi_device > > *device, u32 event) > > users = button->input->users; > > mutex_unlock(&button->input->mutex); > > if (users) > > - acpi_lid_update_state(device); > > + acpi_lid_update_state(device, true); > > } else { > > int keycode; > > > > -- > > 2.18.0.rc1.242.g61856ae69a-goog > > > > >