pm: device: remove usage of local states

The device PM subsystem already holds the device state, so there is no
need to keep duplicates inside the device. The pm_device_state_get has
been refactored to just return the device state. Note that this is still
not safe, but the same applied to the previous implementation. This
problem will be addressed later.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-06-04 17:41:39 +02:00 committed by Anas Nashif
commit c2cf1ad203
48 changed files with 198 additions and 715 deletions

View file

@ -64,9 +64,6 @@
#include <pm/device.h>
__pinned_bss
uint32_t loapic_suspend_buf[LOPIC_SUSPEND_BITS_REQD / 32] = {0};
__pinned_data
static uint32_t loapic_device_power_state = PM_DEVICE_STATE_ACTIVE;
#endif
#ifdef DEVICE_MMIO_IS_IN_RAM
@ -372,7 +369,7 @@ static int loapic_suspend(const struct device *port)
}
}
}
loapic_device_power_state = PM_DEVICE_STATE_SUSPEND;
return 0;
}
@ -402,7 +399,6 @@ int loapic_resume(const struct device *port)
}
}
}
loapic_device_power_state = PM_DEVICE_STATE_ACTIVE;
return 0;
}
@ -424,8 +420,6 @@ static int loapic_device_ctrl(const struct device *port,
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
ret = loapic_resume(port);
}
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
*state = loapic_device_power_state;
}
return ret;