power: device: void *context -> uint32_t *state

The context parameter used across device power management is
actually the power state. Just use it and avoid a lot of
unnecessary casts.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-03-31 23:06:33 -07:00 committed by Anas Nashif
commit 7eba310220
30 changed files with 111 additions and 109 deletions

View file

@ -186,7 +186,8 @@ void eth_mcux_phy_stop(struct eth_context *context);
static int eth_mcux_device_pm_control(const struct device *dev,
uint32_t command,
void *context, pm_device_cb cb, void *arg)
uint32_t *state, pm_device_cb cb,
void *arg)
{
struct eth_context *eth_ctx = (struct eth_context *)dev->data;
int ret = 0;
@ -199,7 +200,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
}
if (command == PM_DEVICE_STATE_SET) {
if (*(uint32_t *)context == PM_DEVICE_SUSPEND_STATE) {
if (*state == PM_DEVICE_SUSPEND_STATE) {
LOG_DBG("Suspending");
ret = net_if_suspend(eth_ctx->iface);
@ -214,7 +215,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
ENET_Deinit(eth_ctx->base);
clock_control_off(eth_ctx->clock_dev,
(clock_control_subsys_t)eth_ctx->clock);
} else if (*(uint32_t *)context == PM_DEVICE_ACTIVE_STATE) {
} else if (*state == PM_DEVICE_ACTIVE_STATE) {
LOG_DBG("Resuming");
clock_control_on(eth_ctx->clock_dev,
@ -228,7 +229,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
out:
if (cb) {
cb(dev, ret, context, arg);
cb(dev, ret, state, arg);
}
return ret;