Skip to content

Commit a9aba82

Browse files
Flavio Ceolincfriedt
authored andcommitted
pm: Fix device resume order
Devices need to be resumed in the reverse order they are suspended. e.g: devA +---> devB ---> devD | +---> devC They are initialized in the following order, devA -> devB -> devC -> devD, and suspended starting from the end of the list, devD -> devC -> devB -> devA. When they are suspended they are temporary put in a list that is used later to resume them. This list has to be iterated from the end to the beginning, otherwise a device may be resumed before its parent. Signed-off-by: Flavio Ceolin <[email protected]>
1 parent e7df33e commit a9aba82

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/pm/device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ int pm_low_power_devices(void)
6666

6767
void pm_resume_devices(void)
6868
{
69-
size_t i;
69+
int32_t i;
7070

71-
for (i = 0; i < num_susp; i++) {
71+
for (i = (num_susp - 1); i >= 0; i--) {
7272
pm_device_state_set(__pm_device_slots_start[i],
7373
PM_DEVICE_STATE_ACTIVE);
7474
}

0 commit comments

Comments
 (0)