pm: device: remove pointer usage for state
Since the state is no longer modified by the device PM callback, just use the state value. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
9e7d545bb4
commit
11eef4d8c8
41 changed files with 100 additions and 100 deletions
|
@ -500,12 +500,12 @@ static int st7735r_enter_sleep(struct st7735r_data *data)
|
|||
}
|
||||
|
||||
static int st7735r_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
struct st7735r_data *data = (struct st7735r_data *)dev->data;
|
||||
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = st7735r_exit_sleep(data);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
|
|
|
@ -402,11 +402,11 @@ static void st7789v_enter_sleep(struct st7789v_data *data)
|
|||
}
|
||||
|
||||
static int st7789v_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
struct st7789v_data *data = (struct st7789v_data *)dev->data;
|
||||
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
st7789v_exit_sleep(data);
|
||||
} else {
|
||||
st7789v_enter_sleep(data);
|
||||
|
|
|
@ -291,14 +291,14 @@ static int entropy_cc13xx_cc26xx_set_power_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int entropy_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
ret = entropy_cc13xx_cc26xx_set_power_state(dev, *state);
|
||||
if (state != curr_state) {
|
||||
ret = entropy_cc13xx_cc26xx_set_power_state(dev, state);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -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_state state)
|
||||
{
|
||||
struct eth_context *eth_ctx = (struct eth_context *)dev->data;
|
||||
int ret = 0;
|
||||
|
@ -197,7 +197,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (*state == PM_DEVICE_STATE_SUSPEND) {
|
||||
if (state == PM_DEVICE_STATE_SUSPEND) {
|
||||
LOG_DBG("Suspending");
|
||||
|
||||
ret = net_if_suspend(eth_ctx->iface);
|
||||
|
@ -212,7 +212,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 (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
} else if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
LOG_DBG("Resuming");
|
||||
|
||||
clock_control_on(eth_ctx->clock_dev,
|
||||
|
|
|
@ -625,15 +625,15 @@ static int spi_flash_at45_init(const struct device *dev)
|
|||
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
static int spi_flash_at45_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
const struct spi_flash_at45_config *dev_config = get_dev_config(dev);
|
||||
int err = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
if (state != curr_state) {
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
acquire(dev);
|
||||
power_down_op(dev, CMD_EXIT_DPD,
|
||||
|
|
|
@ -442,13 +442,13 @@ static inline int gpio_dw_resume_from_suspend_port(const struct device *port)
|
|||
* the *context may include IN data or/and OUT data
|
||||
*/
|
||||
static int gpio_dw_device_ctrl(const struct device *port,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (*state == PM_DEVICE_STATE_SUSPEND) {
|
||||
if (state == PM_DEVICE_STATE_SUSPEND) {
|
||||
ret = gpio_dw_suspend_port(port);
|
||||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
} else if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = gpio_dw_resume_from_suspend_port(port);
|
||||
}
|
||||
|
||||
|
|
|
@ -595,14 +595,14 @@ static int gpio_stm32_set_power_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int gpio_stm32_pm_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
ret = gpio_stm32_set_power_state(dev, *state);
|
||||
if (state != curr_state) {
|
||||
ret = gpio_stm32_set_power_state(dev, state);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -365,13 +365,13 @@ static int i2c_cc13xx_cc26xx_set_power_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
if (state != curr_state) {
|
||||
ret = i2c_cc13xx_cc26xx_set_power_state(dev,
|
||||
new_state);
|
||||
}
|
||||
|
|
|
@ -217,14 +217,14 @@ static int init_twi(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int twi_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
if (state != curr_state) {
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
init_twi(dev);
|
||||
if (get_dev_data(dev)->dev_config) {
|
||||
|
|
|
@ -255,14 +255,14 @@ static int init_twim(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int twim_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
if (state != curr_state) {
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
init_twim(dev);
|
||||
if (get_dev_data(dev)->dev_config) {
|
||||
|
|
|
@ -175,14 +175,14 @@ static int arc_v2_irq_unit_resume(const struct device *dev)
|
|||
* @return operation result
|
||||
*/
|
||||
static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int key = arch_irq_lock();
|
||||
|
||||
if (*state == PM_DEVICE_STATE_SUSPEND) {
|
||||
if (state == PM_DEVICE_STATE_SUSPEND) {
|
||||
ret = arc_v2_irq_unit_suspend(dev);
|
||||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
} else if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = arc_v2_irq_unit_resume(dev);
|
||||
}
|
||||
|
||||
|
|
|
@ -310,13 +310,13 @@ int ioapic_resume_from_suspend(const struct device *port)
|
|||
*/
|
||||
__pinned_func
|
||||
static int ioapic_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
switch (*state) {
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_LOW_POWER:
|
||||
break;
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
|
|
|
@ -409,13 +409,13 @@ int loapic_resume(const struct device *port)
|
|||
*/
|
||||
__pinned_func
|
||||
static int loapic_device_ctrl(const struct device *port,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (*state == PM_DEVICE_STATE_SUSPEND) {
|
||||
if (state == PM_DEVICE_STATE_SUSPEND) {
|
||||
ret = loapic_suspend(port);
|
||||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
} else if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = loapic_resume(port);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,9 +143,9 @@ static int led_pwm_pm_set_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int led_pwm_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
return led_pwm_pm_set_state(dev, *state);
|
||||
return led_pwm_pm_set_state(dev, state);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM_DEVICE */
|
||||
|
|
|
@ -318,14 +318,14 @@ static int pwm_nrfx_set_power_state(enum pm_device_state new_state,
|
|||
}
|
||||
|
||||
static int pwm_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int err = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != current_state) {
|
||||
err = pwm_nrfx_set_power_state(*state, current_state, dev);
|
||||
if (state != current_state) {
|
||||
err = pwm_nrfx_set_power_state(state, current_state, dev);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -333,7 +333,7 @@ static int pwm_nrfx_pm_control(const struct device *dev,
|
|||
|
||||
#define PWM_NRFX_PM_CONTROL(idx) \
|
||||
static int pwm_##idx##_nrfx_pm_control(const struct device *dev, \
|
||||
enum pm_device_state *state) \
|
||||
enum pm_device_state state) \
|
||||
{ \
|
||||
return pwm_nrfx_pm_control(dev, state) \
|
||||
}
|
||||
|
|
|
@ -409,13 +409,13 @@ static int apds9960_init_interrupt(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int apds9960_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
const struct apds9960_config *config = dev->config;
|
||||
struct apds9960_data *data = dev->data;
|
||||
int ret = 0;
|
||||
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
if (i2c_reg_update_byte(data->i2c, config->i2c_address,
|
||||
APDS9960_ENABLE_REG,
|
||||
APDS9960_ENABLE_PON,
|
||||
|
|
|
@ -410,13 +410,13 @@ static int bme280_chip_init(const struct device *dev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
int bme280_pm_ctrl(const struct device *dev, enum pm_device_state *state)
|
||||
int bme280_pm_ctrl(const struct device *dev, enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
if (state != curr_state) {
|
||||
|
||||
/* Switching from OFF to any */
|
||||
if (curr_state == PM_DEVICE_STATE_OFF) {
|
||||
|
@ -425,7 +425,7 @@ int bme280_pm_ctrl(const struct device *dev, enum pm_device_state *state)
|
|||
ret = bme280_chip_init(dev);
|
||||
}
|
||||
/* Switching to OFF from any */
|
||||
else if (*state == PM_DEVICE_STATE_OFF) {
|
||||
else if (state == PM_DEVICE_STATE_OFF) {
|
||||
|
||||
/* Put the chip into sleep mode */
|
||||
ret = bme280_reg_write(dev,
|
||||
|
|
|
@ -583,11 +583,11 @@ static int bmp388_set_power_state(const struct device *dev,
|
|||
|
||||
static int bmp388_device_ctrl(
|
||||
const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = bmp388_set_power_state(dev, *state);
|
||||
ret = bmp388_set_power_state(dev, state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -732,17 +732,17 @@ static int bq274xx_exit_shutdown_mode(const struct device *dev)
|
|||
}
|
||||
|
||||
static int bq274xx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
struct bq274xx_data *data = dev->data;
|
||||
|
||||
if (*state == PM_DEVICE_STATE_OFF) {
|
||||
if (state == PM_DEVICE_STATE_OFF) {
|
||||
ret = bq274xx_enter_shutdown_mode(data);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Unable to enter off state");
|
||||
}
|
||||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
} else if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = bq274xx_exit_shutdown_mode(dev);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Unable to enter active state");
|
||||
|
|
|
@ -535,7 +535,7 @@ static int fdc2x1x_set_pm_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int fdc2x1x_device_pm_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
struct fdc2x1x_data *data = dev->data;
|
||||
int ret = 0;
|
||||
|
@ -543,12 +543,12 @@ static int fdc2x1x_device_pm_ctrl(const struct device *dev,
|
|||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
if (state != curr_state) {
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
case PM_DEVICE_STATE_LOW_POWER:
|
||||
case PM_DEVICE_STATE_OFF:
|
||||
ret = fdc2x1x_set_pm_state(dev, *state);
|
||||
ret = fdc2x1x_set_pm_state(dev, state);
|
||||
break;
|
||||
default:
|
||||
LOG_ERR("PM state not supported");
|
||||
|
|
|
@ -476,7 +476,7 @@ static int lis2mdl_set_power_state(struct lis2mdl_data *lis2mdl,
|
|||
}
|
||||
|
||||
static int lis2mdl_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
struct lis2mdl_data *lis2mdl = dev->data;
|
||||
const struct lis2mdl_config *const config = dev->config;
|
||||
|
@ -484,8 +484,8 @@ static int lis2mdl_pm_control(const struct device *dev,
|
|||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
status = lis2mdl_set_power_state(lis2mdl, config, *state);
|
||||
if (state != curr_state) {
|
||||
status = lis2mdl_set_power_state(lis2mdl, config, state);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
|
@ -240,14 +240,14 @@ static int qdec_nrfx_pm_set_state(struct qdec_nrfx_data *data,
|
|||
}
|
||||
|
||||
static int qdec_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
struct qdec_nrfx_data *data = &qdec_nrfx_data;
|
||||
int err;
|
||||
|
||||
LOG_DBG("");
|
||||
|
||||
err = qdec_nrfx_pm_set_state(data, *state);
|
||||
err = qdec_nrfx_pm_set_state(data, state);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -218,9 +218,9 @@ static int sgp40_set_power_state(const struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sgp40_pm_ctrl(const struct device *dev, enum pm_device_state *state)
|
||||
static int sgp40_pm_ctrl(const struct device *dev, enum pm_device_state state)
|
||||
{
|
||||
return sgp40_set_power_state(dev, *state);
|
||||
return sgp40_set_power_state(dev, state);
|
||||
}
|
||||
#endif /* CONFIG_PM_DEVICE */
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ static int vcnl4040_ambient_setup(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int vcnl4040_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
uint16_t ps_conf;
|
||||
|
@ -234,7 +234,7 @@ static int vcnl4040_device_ctrl(const struct device *dev,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
#endif
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
/* Clear proximity shutdown */
|
||||
ps_conf &= ~VCNL4040_PS_SD_MASK;
|
||||
|
||||
|
|
|
@ -441,14 +441,14 @@ static int uart_cc13xx_cc26xx_set_power_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int uart_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
ret = uart_cc13xx_cc26xx_set_power_state(dev, *state);
|
||||
if (state != curr_state) {
|
||||
ret = uart_cc13xx_cc26xx_set_power_state(dev, state);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -458,9 +458,9 @@ static inline int uart_npcx_set_power_state(const struct device *dev,
|
|||
|
||||
/* Implements the device power management control functionality */
|
||||
static int uart_npcx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
return uart_npcx_set_power_state(dev, *state);
|
||||
return uart_npcx_set_power_state(dev, state);
|
||||
}
|
||||
#endif /* CONFIG_PM_DEVICE */
|
||||
|
||||
|
|
|
@ -1159,13 +1159,13 @@ static void uart_nrfx_set_power_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int uart_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
enum pm_device_state current_state;
|
||||
|
||||
(void)pm_device_state_get(dev, ¤t_state);
|
||||
if (*state != current_state) {
|
||||
uart_nrfx_set_power_state(dev, *state);
|
||||
if (state != current_state) {
|
||||
uart_nrfx_set_power_state(dev, state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1922,13 +1922,13 @@ static void uarte_nrfx_set_power_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int uarte_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
uarte_nrfx_set_power_state(dev, *state);
|
||||
if (state != curr_state) {
|
||||
uarte_nrfx_set_power_state(dev, state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1460,13 +1460,13 @@ static int uart_stm32_set_power_state(const struct device *dev,
|
|||
* @return 0
|
||||
*/
|
||||
static int uart_stm32_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
uart_stm32_set_power_state(dev, *state);
|
||||
if (state != curr_state) {
|
||||
uart_stm32_set_power_state(dev, state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -248,14 +248,14 @@ static int spi_cc13xx_cc26xx_set_power_state(const struct device *dev,
|
|||
}
|
||||
|
||||
static int spi_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
ret = spi_cc13xx_cc26xx_set_power_state(dev, *state);
|
||||
if (state != curr_state) {
|
||||
ret = spi_cc13xx_cc26xx_set_power_state(dev, state);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -278,7 +278,7 @@ static int init_spi(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int spi_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
struct spi_nrfx_data *data = get_dev_data(dev);
|
||||
|
@ -286,8 +286,8 @@ static int spi_nrfx_pm_control(const struct device *dev,
|
|||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
if (state != curr_state) {
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
ret = init_spi(dev);
|
||||
/* Force reconfiguration before next transfer */
|
||||
|
|
|
@ -325,7 +325,7 @@ static int init_spim(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int spim_nrfx_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
int ret = 0;
|
||||
struct spi_nrfx_data *data = get_dev_data(dev);
|
||||
|
@ -333,8 +333,8 @@ static int spim_nrfx_pm_control(const struct device *dev,
|
|||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
if (state != curr_state) {
|
||||
switch (state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
ret = init_spim(dev);
|
||||
/* Force reconfiguration before next transfer */
|
||||
|
|
|
@ -31,7 +31,7 @@ int __weak sys_clock_driver_init(const struct device *dev)
|
|||
}
|
||||
|
||||
int __weak sys_clock_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ struct device {
|
|||
#ifdef CONFIG_PM_DEVICE
|
||||
/** Power Management function */
|
||||
int (*pm_control)(const struct device *dev,
|
||||
enum pm_device_state *state);
|
||||
enum pm_device_state state);
|
||||
/** Pointer to device instance power management data */
|
||||
struct pm_device * const pm;
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,7 @@ extern int sys_clock_driver_init(const struct device *dev);
|
|||
* if undefined in the clock driver.
|
||||
*/
|
||||
extern int clock_device_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state);
|
||||
enum pm_device_state state);
|
||||
|
||||
/**
|
||||
* @brief Set system clock timeout
|
||||
|
|
|
@ -87,9 +87,9 @@ static int dummy_close(const struct device *dev)
|
|||
}
|
||||
|
||||
static int dummy_device_pm_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
printk("child resuming..\n");
|
||||
} else {
|
||||
printk("child suspending..\n");
|
||||
|
|
|
@ -25,9 +25,9 @@ static int dummy_transfer(const struct device *dev, uint32_t cmd,
|
|||
}
|
||||
|
||||
static int dummy_parent_pm_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
printk("parent resuming..\n");
|
||||
} else {
|
||||
printk("parent suspending..\n");
|
||||
|
|
|
@ -137,7 +137,7 @@ int pm_device_state_set(const struct device *dev,
|
|||
return -ENOSYS;
|
||||
}
|
||||
|
||||
ret = dev->pm_control(dev, &device_power_state);
|
||||
ret = dev->pm_control(dev, device_power_state);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -22,17 +22,17 @@ struct fake_dev_context {
|
|||
};
|
||||
|
||||
static int fake_dev_pm_control(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
struct fake_dev_context *ctx = dev->data;
|
||||
int ret = 0;
|
||||
|
||||
if (*state == PM_DEVICE_STATE_SUSPEND) {
|
||||
if (state == PM_DEVICE_STATE_SUSPEND) {
|
||||
ret = net_if_suspend(ctx->iface);
|
||||
if (ret == -EBUSY) {
|
||||
goto out;
|
||||
}
|
||||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
} else if (state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = net_if_resume(ctx->iface);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static int dummy_close_sync(const struct device *dev)
|
|||
}
|
||||
|
||||
static int dummy_device_pm_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ static int dummy_close(const struct device *dev)
|
|||
}
|
||||
|
||||
static int dummy_device_pm_ctrl(const struct device *dev,
|
||||
enum pm_device_state *state)
|
||||
enum pm_device_state state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue