pm: use actions for device PM control
Instead of passing target states, use actions for device PM control. Actions represent better the meaning of the callback argument. Furthermore, they are more future proof as they can be suitable for other PM actions that have no direct mapping to a state. If we compare with Linux, we could have a multi-stage suspend/resume. Such scenario would not have a good mapping when using target states. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
8be0472ba8
commit
7ccc1a41bc
40 changed files with 176 additions and 145 deletions
|
@ -185,7 +185,7 @@ static void eth_mcux_phy_enter_reset(struct eth_context *context);
|
|||
void eth_mcux_phy_stop(struct eth_context *context);
|
||||
|
||||
static int eth_mcux_device_pm_control(const struct device *dev,
|
||||
enum pm_device_state state)
|
||||
enum pm_device_action action)
|
||||
{
|
||||
struct eth_context *eth_ctx = (struct eth_context *)dev->data;
|
||||
int ret = 0;
|
||||
|
@ -197,8 +197,8 @@ static int eth_mcux_device_pm_control(const struct device *dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_SUSPENDED:
|
||||
switch (action) {
|
||||
case PM_DEVICE_ACTION_SUSPEND:
|
||||
LOG_DBG("Suspending");
|
||||
|
||||
ret = net_if_suspend(eth_ctx->iface);
|
||||
|
@ -214,7 +214,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
|
|||
clock_control_off(eth_ctx->clock_dev,
|
||||
(clock_control_subsys_t)eth_ctx->clock);
|
||||
break;
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
case PM_DEVICE_ACTION_RESUME:
|
||||
LOG_DBG("Resuming");
|
||||
|
||||
clock_control_on(eth_ctx->clock_dev,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue