summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorAaron Massey <aaronmassey@google.com>2022-10-13 13:26:16 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-14 21:20:33 +0000
commit2c78ade6deabe07143840e01e97e2d2db09890e5 (patch)
tree9196b50932ea014dbdd5e0b2637913599aa917ee /power
parent9997063cc4b98a9563a9ede8084c729cd2ae8af1 (diff)
downloadchrome-ec-2c78ade6deabe07143840e01e97e2d2db09890e5.tar.gz
test: host_sleep.c sleep_set_notify
Add a test that verifies behavior from sleep_set_notify and correspondly sleep_notify_transition. Scenarios: * Setting notify state and sleep_notify_transition can fire hook * Setting notify state and sleep_notify_transition clears notify state. * sleep_notify_transition can start a hook with NONE sleep notify state Also conducted two small refactor fixes: * Made privately used variable static * Changed an int type to how it's actually used (enum sleep_notify_type) BRANCH=none BUG=b:252887178 TEST=twister -s zephyr/test/drivers/drivers.power_host_sleep Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I9d63d1377359035b316ac6aa5de87376b3bb203f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3953317 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'power')
-rw-r--r--power/host_sleep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/power/host_sleep.c b/power/host_sleep.c
index da7189083a..b97fb904c1 100644
--- a/power/host_sleep.c
+++ b/power/host_sleep.c
@@ -85,7 +85,7 @@ void power_set_host_sleep_state(enum host_sleep_event state)
}
/* Flag to notify listeners about suspend/resume events. */
-enum sleep_notify_type sleep_notify = SLEEP_NOTIFY_NONE;
+static enum sleep_notify_type sleep_notify = SLEEP_NOTIFY_NONE;
/*
* Note: the following sleep_ functions do not get called in the S3 path on
@@ -96,7 +96,7 @@ void sleep_set_notify(enum sleep_notify_type notify)
sleep_notify = notify;
}
-void sleep_notify_transition(int check_state, int hook_id)
+void sleep_notify_transition(enum sleep_notify_type check_state, int hook_id)
{
if (sleep_notify != check_state)
return;