pm: fully initialize pm_device on Z_DEVICE_STATE_DEFINE
The initialization of the struct pm_device pm field found in the device state can be statically initialized without the need of doing it at runtime. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
c5e077c48f
commit
9917de4a1b
2 changed files with 6 additions and 14 deletions
|
@ -839,6 +839,12 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
|
|||
static struct device_state Z_DEVICE_STATE_NAME(dev_name) \
|
||||
__attribute__((__section__(".z_devstate"))) = { \
|
||||
.pm = { \
|
||||
.usage = ATOMIC_INIT(0), \
|
||||
.lock = Z_MUTEX_INITIALIZER( \
|
||||
Z_DEVICE_STATE_NAME(dev_name).pm.lock), \
|
||||
.condvar = Z_CONDVAR_INITIALIZER( \
|
||||
Z_DEVICE_STATE_NAME(dev_name).pm.condvar),\
|
||||
.state = PM_DEVICE_STATE_ACTIVE, \
|
||||
.flags = ATOMIC_INIT(COND_CODE_1( \
|
||||
DT_NODE_EXISTS(node_id), \
|
||||
(DT_PROP_OR( \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue