diff mbox series

platform/chrome: cros_ec: Log wake events during resume

Message ID 20220912213334.2703872-1-jthies@google.com (mailing list archive)
State Superseded
Headers show
Series platform/chrome: cros_ec: Log wake events during resume | expand

Commit Message

Jameson Thies Sept. 12, 2022, 9:33 p.m. UTC
Update cros_ec_report_events_during_suspend to log wake events during
resume by calling pm_wakeup_event.

Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Prashant Malani <pmalani@chromium.org>
---
 drivers/platform/chrome/cros_ec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Benson Leung Sept. 12, 2022, 9:37 p.m. UTC | #1
Hi Jameson,

On Mon, Sep 12, 2022 at 2:34 PM Jameson Thies <jthies@google.com> wrote:
>
> Update cros_ec_report_events_during_suspend to log wake events during
> resume by calling pm_wakeup_event.
>

Minor nit, isn't it more accurate to say that this change "signals" or
"notifies" a wakeup event rather than just log? Log indicates some
print to a logging service, which may happen, but as a side effect of
the actual pm_wakeup_event call, which does something real on its own.

Thanks,
Benson

> Signed-off-by: Jameson Thies <jthies@google.com>
> Reviewed-by: Prashant Malani <pmalani@chromium.org>
> ---
>  drivers/platform/chrome/cros_ec.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c
> index 8aace50d446d..110df0fd4b00 100644
> --- a/drivers/platform/chrome/cros_ec.c
> +++ b/drivers/platform/chrome/cros_ec.c
> @@ -349,10 +349,16 @@ EXPORT_SYMBOL(cros_ec_suspend);
>
>  static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev)
>  {
> +       bool wake_event;
> +
>         while (ec_dev->mkbp_event_supported &&
> -              cros_ec_get_next_event(ec_dev, NULL, NULL) > 0)
> +              cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) {
>                 blocking_notifier_call_chain(&ec_dev->event_notifier,
>                                              1, ec_dev);
> +
> +               if (wake_event && device_may_wakeup(ec_dev->dev))
> +                       pm_wakeup_event(ec_dev->dev, 0);
> +       }
>  }
>
>  /**
> --
> 2.37.2.789.g6183377224-goog
>
>
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c
index 8aace50d446d..110df0fd4b00 100644
--- a/drivers/platform/chrome/cros_ec.c
+++ b/drivers/platform/chrome/cros_ec.c
@@ -349,10 +349,16 @@  EXPORT_SYMBOL(cros_ec_suspend);
 
 static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev)
 {
+	bool wake_event;
+
 	while (ec_dev->mkbp_event_supported &&
-	       cros_ec_get_next_event(ec_dev, NULL, NULL) > 0)
+	       cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) {
 		blocking_notifier_call_chain(&ec_dev->event_notifier,
 					     1, ec_dev);
+
+		if (wake_event && device_may_wakeup(ec_dev->dev))
+			pm_wakeup_event(ec_dev->dev, 0);
+	}
 }
 
 /**