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:
parent
9ac646f277
commit
7eba310220
30 changed files with 111 additions and 109 deletions
|
@ -409,14 +409,14 @@ static void st7789v_enter_sleep(struct st7789v_data *data)
|
|||
}
|
||||
|
||||
static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||
void *context, pm_device_cb cb, void *arg)
|
||||
uint32_t *state, pm_device_cb cb, void *arg)
|
||||
{
|
||||
int ret = 0;
|
||||
struct st7789v_data *data = (struct st7789v_data *)dev->data;
|
||||
|
||||
switch (ctrl_command) {
|
||||
case PM_DEVICE_STATE_SET:
|
||||
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||
case DEVICE_PM_SET_POWER_STATE:
|
||||
if (*state == PM_DEVICE_ACTIVE_STATE) {
|
||||
st7789v_exit_sleep(data);
|
||||
data->pm_state = PM_DEVICE_ACTIVE_STATE;
|
||||
ret = 0;
|
||||
|
@ -427,14 +427,14 @@ static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command,
|
|||
}
|
||||
break;
|
||||
case PM_DEVICE_STATE_GET:
|
||||
*((uint32_t *)context) = data->pm_state;
|
||||
*state = data->pm_state;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
if (cb != NULL) {
|
||||
cb(dev, ret, context, arg);
|
||||
cb(dev, ret, state, arg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue