mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
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:
committed by
Anas Nashif
parent
9e7d545bb4
commit
11eef4d8c8
@@ -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");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user