pm: cleanup pm control callback implementations

- Return -ENOTSUP if the requested state is not supported
- Remove redundant "noop style" functions.
- Use switch everywhere to handle requested state (not necessary in all
  drivers, but better take off with consistency in place after current
  changes).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-07-05 10:35:15 +02:00 committed by Anas Nashif
commit 495672ab62
33 changed files with 263 additions and 334 deletions

View file

@ -180,10 +180,16 @@ static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
int ret = 0;
unsigned int key = arch_irq_lock();
if (state == PM_DEVICE_STATE_SUSPENDED) {
switch (state) {
case PM_DEVICE_STATE_SUSPENDED:
ret = arc_v2_irq_unit_suspend(dev);
} else if (state == PM_DEVICE_STATE_ACTIVE) {
break;
case PM_DEVICE_STATE_ACTIVE:
ret = arc_v2_irq_unit_resume(dev);
break;
default:
ret = -ENOTSUP;
break;
}
arch_irq_unlock(key);