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
|
@ -1461,24 +1461,24 @@ static int uart_stm32_set_power_state(const struct device *dev,
|
|||
*/
|
||||
static int uart_stm32_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)
|
||||
{
|
||||
struct uart_stm32_data *data = DEV_DATA(dev);
|
||||
|
||||
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||
uint32_t new_state = *((const uint32_t *)context);
|
||||
uint32_t new_state = *state;
|
||||
|
||||
if (new_state != data->pm_state) {
|
||||
uart_stm32_set_power_state(dev, new_state);
|
||||
}
|
||||
} else {
|
||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||
*((uint32_t *)context) = data->pm_state;
|
||||
*state = data->pm_state;
|
||||
}
|
||||
|
||||
if (cb) {
|
||||
cb(dev, 0, context, arg);
|
||||
cb(dev, 0, state, arg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue