pm: rename device_pm_cb to pm_device_cb

Prefix all device PM functions/data structures with pm.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-05-03 18:01:40 +02:00 committed by Anas Nashif
commit dbf46b3815
38 changed files with 39 additions and 39 deletions

View file

@ -295,7 +295,7 @@ Device Set Power State
.. code-block:: c .. code-block:: c
int device_set_power_state(const struct device *dev, uint32_t device_power_state, device_pm_cb cb, void *arg); int device_set_power_state(const struct device *dev, uint32_t device_power_state, pm_device_cb cb, void *arg);
Calls the :c:func:`pm_control()` handler function implemented by the Calls the :c:func:`pm_control()` handler function implemented by the
device driver with PM_DEVICE_SET_POWER_STATE command. device driver with PM_DEVICE_SET_POWER_STATE command.

View file

@ -520,7 +520,7 @@ static int st7735r_enter_sleep(struct st7735r_data *data)
} }
static int st7735r_pm_control(const struct device *dev, uint32_t ctrl_command, static int st7735r_pm_control(const struct device *dev, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;
struct st7735r_data *data = (struct st7735r_data *)dev->data; struct st7735r_data *data = (struct st7735r_data *)dev->data;

View file

@ -409,7 +409,7 @@ static void st7789v_enter_sleep(struct st7789v_data *data)
} }
static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command, static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;
struct st7789v_data *data = (struct st7789v_data *)dev->data; struct st7789v_data *data = (struct st7789v_data *)dev->data;

View file

@ -293,7 +293,7 @@ static int entropy_cc13xx_cc26xx_set_power_state(const struct device *dev,
static int entropy_cc13xx_cc26xx_pm_control(const struct device *dev, static int entropy_cc13xx_cc26xx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *context, pm_device_cb cb,
void *arg) void *arg)
{ {
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev); struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev);

View file

@ -186,7 +186,7 @@ void eth_mcux_phy_stop(struct eth_context *context);
static int eth_mcux_device_pm_control(const struct device *dev, static int eth_mcux_device_pm_control(const struct device *dev,
uint32_t command, uint32_t command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct eth_context *eth_ctx = (struct eth_context *)dev->data; struct eth_context *eth_ctx = (struct eth_context *)dev->data;
int ret = 0; int ret = 0;

View file

@ -570,7 +570,7 @@ static int spi_flash_at45_init(const struct device *dev)
#if IS_ENABLED(CONFIG_PM_DEVICE) #if IS_ENABLED(CONFIG_PM_DEVICE)
static int spi_flash_at45_pm_control(const struct device *dev, static int spi_flash_at45_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct spi_flash_at45_data *dev_data = get_dev_data(dev); struct spi_flash_at45_data *dev_data = get_dev_data(dev);
const struct spi_flash_at45_config *dev_config = get_dev_config(dev); const struct spi_flash_at45_config *dev_config = get_dev_config(dev);

View file

@ -461,7 +461,7 @@ static inline int gpio_dw_resume_from_suspend_port(const struct device *port)
*/ */
static int gpio_dw_device_ctrl(const struct device *port, static int gpio_dw_device_ctrl(const struct device *port,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -368,7 +368,7 @@ static int i2c_cc13xx_cc26xx_set_power_state(const struct device *dev,
static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev, static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *context, pm_device_cb cb,
void *arg) void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -215,7 +215,7 @@ static int init_twi(const struct device *dev)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
static int twi_nrfx_pm_control(const struct device *dev, static int twi_nrfx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;
uint32_t pm_current_state = get_dev_data(dev)->pm_state; uint32_t pm_current_state = get_dev_data(dev)->pm_state;

View file

@ -265,7 +265,7 @@ static int init_twim(const struct device *dev)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
static int twim_nrfx_pm_control(const struct device *dev, static int twim_nrfx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;
uint32_t pm_current_state = get_dev_data(dev)->pm_state; uint32_t pm_current_state = get_dev_data(dev)->pm_state;

View file

@ -193,7 +193,7 @@ static int arc_v2_irq_unit_get_state(const struct device *dev)
*/ */
static int arc_v2_irq_unit_device_ctrl(const struct device *dev, static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
uint32_t ctrl_command, void *context, uint32_t ctrl_command, void *context,
device_pm_cb cb, void *arg) pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;
unsigned int key = arch_irq_lock(); unsigned int key = arch_irq_lock();

View file

@ -305,7 +305,7 @@ int ioapic_resume_from_suspend(const struct device *port)
*/ */
static int ioapic_device_ctrl(const struct device *dev, static int ioapic_device_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -404,7 +404,7 @@ int loapic_resume(const struct device *port)
*/ */
static int loapic_device_ctrl(const struct device *port, static int loapic_device_ctrl(const struct device *port,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -176,7 +176,7 @@ static int led_pwm_pm_set_state(const struct device *dev, uint32_t new_state)
} }
static int led_pwm_pm_control(const struct device *dev, uint32_t ctrl_command, static int led_pwm_pm_control(const struct device *dev, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int err; int err;

View file

@ -345,7 +345,7 @@ static int pwm_nrfx_pm_control(const struct device *dev,
static int pwm_##idx##_nrfx_pm_control(const struct device *dev, \ static int pwm_##idx##_nrfx_pm_control(const struct device *dev, \
uint32_t ctrl_command, \ uint32_t ctrl_command, \
void *context, \ void *context, \
device_pm_cb cb, \ pm_device_cb cb, \
void *arg) \ void *arg) \
{ \ { \
static uint32_t current_state = PM_DEVICE_ACTIVE_STATE; \ static uint32_t current_state = PM_DEVICE_ACTIVE_STATE; \

View file

@ -410,7 +410,7 @@ static int apds9960_init_interrupt(const struct device *dev)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
static int apds9960_device_ctrl(const struct device *dev, static int apds9960_device_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
const struct apds9960_config *config = dev->config; const struct apds9960_config *config = dev->config;
struct apds9960_data *data = dev->data; struct apds9960_data *data = dev->data;

View file

@ -391,7 +391,7 @@ static int bme280_chip_init(const struct device *dev)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
int bme280_pm_ctrl(const struct device *dev, uint32_t ctrl_command, int bme280_pm_ctrl(const struct device *dev, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct bme280_data *data = to_data(dev); struct bme280_data *data = to_data(dev);

View file

@ -590,7 +590,7 @@ static int bmp388_device_ctrl(
const struct device *dev, const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, void *context,
device_pm_cb cb, pm_device_cb cb,
void *arg) void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -543,7 +543,7 @@ static int fdc2x1x_set_pm_state(const struct device *dev,
static int fdc2x1x_device_pm_ctrl(const struct device *dev, static int fdc2x1x_device_pm_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct fdc2x1x_data *data = dev->data; struct fdc2x1x_data *data = dev->data;
uint32_t new_state; uint32_t new_state;

View file

@ -520,7 +520,7 @@ static int lis2mdl_set_power_state(struct lis2mdl_data *lis2mdl,
} }
static int lis2mdl_pm_control(const struct device *dev, uint32_t ctrl_command, static int lis2mdl_pm_control(const struct device *dev, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct lis2mdl_data *lis2mdl = dev->data; struct lis2mdl_data *lis2mdl = dev->data;
const struct lis2mdl_config *const config = dev->config; const struct lis2mdl_config *const config = dev->config;

View file

@ -268,7 +268,7 @@ static int qdec_nrfx_pm_set_state(struct qdec_nrfx_data *data,
static int qdec_nrfx_pm_control(const struct device *dev, static int qdec_nrfx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct qdec_nrfx_data *data = &qdec_nrfx_data; struct qdec_nrfx_data *data = &qdec_nrfx_data;
int err; int err;

View file

@ -220,7 +220,7 @@ static int vcnl4040_ambient_setup(const struct device *dev)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
static int vcnl4040_device_ctrl(const struct device *dev, static int vcnl4040_device_ctrl(const struct device *dev,
uint32_t ctrl_command, void *context, uint32_t ctrl_command, void *context,
device_pm_cb cb, void *arg) pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -444,7 +444,7 @@ static int uart_cc13xx_cc26xx_set_power_state(const struct device *dev,
static int uart_cc13xx_cc26xx_pm_control(const struct device *dev, static int uart_cc13xx_cc26xx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *context, pm_device_cb cb,
void *arg) void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -449,7 +449,7 @@ static inline int uart_npcx_set_power_state(const struct device *dev,
/* Implements the device power management control functionality */ /* Implements the device power management control functionality */
static int uart_npcx_pm_control(const struct device *dev, uint32_t ctrl_command, static int uart_npcx_pm_control(const struct device *dev, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -1158,7 +1158,7 @@ static void uart_nrfx_set_power_state(const struct device *dev,
static int uart_nrfx_pm_control(const struct device *dev, static int uart_nrfx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
static uint32_t current_state = PM_DEVICE_ACTIVE_STATE; static uint32_t current_state = PM_DEVICE_ACTIVE_STATE;

View file

@ -1863,7 +1863,7 @@ static void uarte_nrfx_set_power_state(const struct device *dev,
static int uarte_nrfx_pm_control(const struct device *dev, static int uarte_nrfx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct uarte_nrfx_data *data = get_dev_data(dev); struct uarte_nrfx_data *data = get_dev_data(dev);

View file

@ -1461,7 +1461,7 @@ static int uart_stm32_set_power_state(const struct device *dev,
*/ */
static int uart_stm32_pm_control(const struct device *dev, static int uart_stm32_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *context, pm_device_cb cb,
void *arg) void *arg)
{ {
struct uart_stm32_data *data = DEV_DATA(dev); struct uart_stm32_data *data = DEV_DATA(dev);

View file

@ -251,7 +251,7 @@ static int spi_cc13xx_cc26xx_set_power_state(const struct device *dev,
static int spi_cc13xx_cc26xx_pm_control(const struct device *dev, static int spi_cc13xx_cc26xx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *context, pm_device_cb cb,
void *arg) void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -286,7 +286,7 @@ static int init_spi(const struct device *dev)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
static int spi_nrfx_pm_control(const struct device *dev, static int spi_nrfx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;
struct spi_nrfx_data *data = get_dev_data(dev); struct spi_nrfx_data *data = get_dev_data(dev);

View file

@ -334,7 +334,7 @@ static int init_spim(const struct device *dev)
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
static int spim_nrfx_pm_control(const struct device *dev, static int spim_nrfx_pm_control(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;
struct spi_nrfx_data *data = get_dev_data(dev); struct spi_nrfx_data *data = get_dev_data(dev);

View file

@ -32,7 +32,7 @@ int __weak sys_clock_driver_init(const struct device *dev)
int __weak sys_clock_device_ctrl(const struct device *dev, int __weak sys_clock_device_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
return -ENOTSUP; return -ENOTSUP;
} }

View file

@ -387,7 +387,7 @@ struct device {
#ifdef CONFIG_PM_DEVICE #ifdef CONFIG_PM_DEVICE
/** Power Management function */ /** Power Management function */
int (*pm_control)(const struct device *dev, uint32_t command, int (*pm_control)(const struct device *dev, uint32_t command,
void *context, device_pm_cb cb, void *arg); void *context, pm_device_cb cb, void *arg);
/** Pointer to device instance power management data */ /** Pointer to device instance power management data */
struct pm_device * const pm; struct pm_device * const pm;
#endif #endif
@ -657,7 +657,7 @@ void device_busy_clear(const struct device *dev);
*/ */
static inline int device_set_power_state(const struct device *dev, static inline int device_set_power_state(const struct device *dev,
uint32_t device_power_state, uint32_t device_power_state,
device_pm_cb cb, void *arg) pm_device_cb cb, void *arg)
{ {
if (dev->pm_control == NULL) { if (dev->pm_control == NULL) {
return -ENOSYS; return -ENOSYS;

View file

@ -48,7 +48,7 @@ extern int sys_clock_driver_init(const struct device *dev);
*/ */
extern int clock_device_ctrl(const struct device *dev, extern int clock_device_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg); void *context, pm_device_cb cb, void *arg);
/** /**
* @brief Set system clock timeout * @brief Set system clock timeout

View file

@ -77,7 +77,7 @@ struct device;
#define PM_DEVICE_SET_POWER_STATE 1 #define PM_DEVICE_SET_POWER_STATE 1
#define PM_DEVICE_GET_POWER_STATE 2 #define PM_DEVICE_GET_POWER_STATE 2
typedef void (*device_pm_cb)(const struct device *dev, typedef void (*pm_device_cb)(const struct device *dev,
int status, void *context, void *arg); int status, void *context, void *arg);
/** /**

View file

@ -116,7 +116,7 @@ static int dummy_resume_from_suspend(const struct device *dev)
static int dummy_device_pm_ctrl(const struct device *dev, static int dummy_device_pm_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -47,7 +47,7 @@ static int dummy_resume_from_suspend(const struct device *dev)
static int dummy_parent_pm_ctrl(const struct device *dev, static int dummy_parent_pm_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;

View file

@ -22,7 +22,7 @@ struct fake_dev_context {
}; };
static int fake_dev_pm_control(const struct device *dev, uint32_t command, static int fake_dev_pm_control(const struct device *dev, uint32_t command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
struct fake_dev_context *ctx = dev->data; struct fake_dev_context *ctx = dev->data;
int ret = 0; int ret = 0;

View file

@ -40,7 +40,7 @@ static int dummy_resume_from_suspend(const struct device *dev)
static int dummy_device_pm_ctrl(const struct device *dev, static int dummy_device_pm_ctrl(const struct device *dev,
uint32_t ctrl_command, uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg) void *context, pm_device_cb cb, void *arg)
{ {
int ret = 0; int ret = 0;