Refactor this code so it has less nesting and is able to share some code
between functions, by making a function to find the device constraints
object which can be called before doing operations using it.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
When PM_POLICY_DEVICE_CONSTRAINTS is enabled, we create a list of
devices with the property “zephyr,disabling-power-states” and their
respective states to lock. However, if a device is declared but not
built (e.g., due to a Kconfig option), we have an undefined reference.
This PR changes the code to use the device name instead of the
reference. This increases lookup time (which could be cached at
runtime), and we still have an entry for a non-existent device.
Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
policy.c has grown organically, it contained many independent pieces of
code. This patch splits each logical unit into its own C file, making it
easier to browse the code.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>