samples: pm: device_pm: Get the device before use it
The open function should resume the device, not only its parent. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
c124f40f14
commit
8fdb0117eb
1 changed files with 6 additions and 0 deletions
|
|
@ -25,6 +25,12 @@ static int dummy_open(const struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = pm_device_runtime_get(dev);
|
||||
if (ret < 0) {
|
||||
(void)pm_device_runtime_put(parent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
(void)pm_device_state_get(dev, &state);
|
||||
if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
printk("Dummy device resumed\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue