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:
parent
d41dadc569
commit
495672ab62
33 changed files with 263 additions and 334 deletions
|
@ -408,15 +408,20 @@ int loapic_resume(const struct device *port)
|
|||
* the *context may include IN data or/and OUT data
|
||||
*/
|
||||
__pinned_func
|
||||
static int loapic_device_ctrl(const struct device *port,
|
||||
static int loapic_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (state == PM_DEVICE_STATE_SUSPENDED) {
|
||||
ret = loapic_suspend(port);
|
||||
} else if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = loapic_resume(port);
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_SUSPENDED:
|
||||
ret = loapic_suspend(dev);
|
||||
break;
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
ret = loapic_resume(dev);
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue