Skip to content

Commit 807872f

Browse files
pm: policy: fix pm_policy_event_register arg
The pm_policy_event_register() API takes absolute cycles as the second arg, like pm_policy_event_update(), but the arg is renamed time_us and treated as a relative time in us rather than abs cycles. Fix implementation of pm_policy_event_register() to treat cycles like pm_policy_event_update() and API docs suggest. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent afce532 commit 807872f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

subsys/pm/policy/policy_events.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,13 @@ int32_t pm_policy_next_event_ticks(void)
6868
return -1;
6969
}
7070

71-
void pm_policy_event_register(struct pm_policy_event *evt, uint32_t time_us)
71+
void pm_policy_event_register(struct pm_policy_event *evt, uint32_t cycle)
7272
{
7373
k_spinlock_key_t key = k_spin_lock(&events_lock);
74-
uint32_t cyc = k_cycle_get_32();
7574

76-
evt->value_cyc = cyc + k_us_to_cyc_ceil32(time_us);
75+
evt->value_cyc = cycle;
7776
sys_slist_append(&events_list, &evt->node);
78-
update_next_event(cyc);
77+
update_next_event(k_cycle_get_32());
7978

8079
k_spin_unlock(&events_lock, key);
8180
}

0 commit comments

Comments
 (0)