Skip to content
Commit a6d34bec authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Anas Nashif
Browse files

pm: device_runtime: Keep enable behavior consistent



It is not possible to rely on pm->dev to do lazy initialization of
some components. For example, in the follow sequence of commands:

1 - pm_device_runtime_enable()
  pm->state == PM_DEVICE_STATE_SUSPENDED;
2 - pm_device_runtime_disable()
  pm->state == PM_DEVICE_STATE_ACTIVE;
3 - pm_device_runtime_enable()
  pm->state == PM_DEVICE_STATE_ACTIVE

After the first time pm_device_runtime_enable(), the device state will
be suspended, but after the second time this function executes the state
will be active. That is not consistent.

It is just easier to remove the branch check and always set those
fields for the sake of consistent.

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
parent de3fccdd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment