LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ACPI LID: increment wakeup count only when notified.
@ 2018-06-04 18:26 Ravi Chandra Sadineni
  2018-06-04 19:19 ` Benson Leung
  2018-06-06  7:00 ` Rafael J. Wysocki
  0 siblings, 2 replies; 11+ messages in thread
From: Ravi Chandra Sadineni @ 2018-06-04 18:26 UTC (permalink / raw)
  To: rjw, lenb, ravisadineni, ravisadineni
  Cc: dmitry.torokhov, tbroch, linux-kernel, linux-acpi, rajatja,
	bleung, furquan

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 <ravisadineni@chromium.org>
---
 drivers/acpi/button.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index f1cc4f9d31cd9..d40fef7241f08 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,
@@ -417,6 +414,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
 		/* fall through */
 	case ACPI_BUTTON_NOTIFY_STATUS:
 		input = button->input;
+		acpi_pm_wakeup_event(&device->dev);
 		if (button->type == ACPI_BUTTON_TYPE_LID) {
 			mutex_lock(&button->input->mutex);
 			users = button->input->users;
@@ -426,7 +424,6 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
 		} else {
 			int keycode;
 
-			acpi_pm_wakeup_event(&device->dev);
 			if (button->suspended)
 				break;
 
-- 
2.17.1.1185.g55be947832-goog

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-07-04 10:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 18:26 [PATCH] ACPI LID: increment wakeup count only when notified Ravi Chandra Sadineni
2018-06-04 19:19 ` Benson Leung
2018-06-06  7:00 ` Rafael J. Wysocki
2018-06-06 23:11   ` Benson Leung
2018-06-06 23:21     ` Rafael J. Wysocki
2018-06-11 17:57       ` [PATCH V2] " Ravi Chandra Sadineni
     [not found]         ` <CAOGSYL371YSqpqdzqHUC+UxvMtxTc0q=YFPRcT-SeSHO5Pepeg@mail.gmail.com>
2018-06-21 13:11           ` Rafael J. Wysocki
2018-06-26  9:55         ` Rafael J. Wysocki
2018-06-27 17:55           ` [PATCH V3] " Ravi Chandra Sadineni
2018-07-04 10:39             ` Rafael J. Wysocki
2018-06-11 17:59       ` [PATCH] " Ravi Chandra Sadineni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).