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

@ -368,13 +368,13 @@ static int i2c_cc13xx_cc26xx_set_power_state(const struct device *dev,
static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev,
uint32_t ctrl_command,
void *context, pm_device_cb cb,
uint32_t *state, pm_device_cb cb,
void *arg)
{
int ret = 0;
if (ctrl_command == PM_DEVICE_STATE_SET) {
uint32_t new_state = *((const uint32_t *)context);
uint32_t new_state = *state;
if (new_state != get_dev_data(dev)->pm_state) {
ret = i2c_cc13xx_cc26xx_set_power_state(dev,
@ -382,11 +382,11 @@ static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev,
}
} else {
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
*state = get_dev_data(dev)->pm_state;
}
if (cb) {
cb(dev, ret, context, arg);
cb(dev, ret, state, arg);
}
return ret;