Skip to content

Commit

Permalink
drivers: regulator: Place API in iterable section
Browse files Browse the repository at this point in the history
Add wrapper DEVICE_API macro to all regulator_driver_api instances.

Signed-off-by: Pieter De Gendt <[email protected]>
  • Loading branch information
pdgendt committed Nov 30, 2024
1 parent 9a40d68 commit 7fdf15b
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_adp5360.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static int regulator_adp5360_init(const struct device *dev)
return regulator_common_init(dev, (val & ADP5360_BUCK_CFG_EN_MSK) != 0U);
}

static const struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_adp5360_enable,
.disable = regulator_adp5360_disable,
.count_voltages = regulator_adp5360_count_voltages,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_axp192.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static int axp192_get_current_limit(const struct device *dev, int32_t *curr_ua)
return 0;
}

static struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = axp192_enable,
.disable = axp192_disable,
.count_voltages = axp192_count_voltages,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_cp9314.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ static int regulator_cp9314_init(const struct device *dev)
return regulator_common_init(dev, false);
}

static const struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_cp9314_enable,
.disable = regulator_cp9314_disable,
.get_error_flags = regulator_cp9314_get_error_flags,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_da1469x.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static int regulator_da1469x_get_current_limit(const struct device *dev,
return ret;
}

static const struct regulator_driver_api regulator_da1469x_api = {
static DEVICE_API(regulator, regulator_da1469x_api) = {
.enable = regulator_da1469x_enable,
.disable = regulator_da1469x_disable,
.count_voltages = regulator_da1469x_count_voltages,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_fake.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DEFINE_FAKE_VALUE_FUNC(int, regulator_fake_get_active_discharge, const struct de
DEFINE_FAKE_VALUE_FUNC(int, regulator_fake_get_error_flags,
const struct device *, regulator_error_flags_t *);

static struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_fake_enable,
.disable = regulator_fake_disable,
.count_voltages = regulator_fake_count_voltages,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static int regulator_fixed_list_voltage(const struct device *dev,
return 0;
}

static const struct regulator_driver_api regulator_fixed_api = {
static DEVICE_API(regulator, regulator_fixed_api) = {
.enable = regulator_fixed_enable,
.disable = regulator_fixed_disable,
.count_voltages = regulator_fixed_count_voltages,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static int regulator_gpio_get_voltage(const struct device *dev, int32_t *volt_uv
return 0;
}

static const struct regulator_driver_api regulator_gpio_api = {
static DEVICE_API(regulator, regulator_gpio_api) = {
.enable = regulator_gpio_enable,
.disable = regulator_gpio_disable,
.set_voltage = regulator_gpio_set_voltage,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_max20335.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static const struct regulator_parent_driver_api parent_api = {
.ship_mode = regulator_max20335_power_off,
};

static const struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_max20335_enable,
.disable = regulator_max20335_disable,
.set_mode = regulator_max20335_set_mode,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_mpm54304.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static int regulator_mpm54304_init(const struct device *dev)
return 0;
}

static const struct regulator_driver_api mpm54304_api = {
static DEVICE_API(regulator, mpm54304_api) = {
.enable = regulator_mpm54304_enable,
.disable = regulator_mpm54304_disable,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_npm1100.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static int regulator_npm1100_common_init(const struct device *dev)
return 0;
}

static const __unused struct regulator_driver_api api = {
static DEVICE_API(regulator, api) __unused = {
.set_mode = regulator_npm1100_set_mode,
.get_mode = regulator_npm1100_get_mode,
};
Expand Down
16 changes: 9 additions & 7 deletions drivers/regulator/regulator_npm1300.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,15 @@ int regulator_npm1300_init(const struct device *dev)
return ret;
}

static const struct regulator_driver_api api = {.enable = regulator_npm1300_enable,
.disable = regulator_npm1300_disable,
.count_voltages = regulator_npm1300_count_voltages,
.list_voltage = regulator_npm1300_list_voltage,
.set_voltage = regulator_npm1300_set_voltage,
.get_voltage = regulator_npm1300_get_voltage,
.set_mode = regulator_npm1300_set_mode};
static DEVICE_API(regulator, api) = {
.enable = regulator_npm1300_enable,
.disable = regulator_npm1300_disable,
.count_voltages = regulator_npm1300_count_voltages,
.list_voltage = regulator_npm1300_list_voltage,
.set_voltage = regulator_npm1300_set_voltage,
.get_voltage = regulator_npm1300_get_voltage,
.set_mode = regulator_npm1300_set_mode,
};

#define REGULATOR_NPM1300_DEFINE(node_id, id, _source) \
static struct regulator_npm1300_data data_##id; \
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_npm6001.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ static int regulator_npm6001_init(const struct device *dev)
return regulator_common_init(dev, is_enabled);
}

static const struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_npm6001_enable,
.disable = regulator_npm6001_disable,
.count_voltages = regulator_npm6001_count_voltages,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_nxp_vref.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int regulator_nxp_vref_get_voltage(const struct device *dev,
return ret;
}

static const struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_nxp_vref_enable,
.disable = regulator_nxp_vref_disable,
.set_mode = regulator_nxp_vref_set_mode,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_pca9420.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static int regulator_pca9420_disable(const struct device *dev)
config->desc->enable_mask, dis_val);
}

static const struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_pca9420_enable,
.disable = regulator_pca9420_disable,
.count_voltages = regulator_pca9420_count_voltages,
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/regulator_rpi_pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int regulator_rpi_pico_init(const struct device *dev)
return regulator_common_init(dev, true);
}

static const struct regulator_driver_api api = {
static DEVICE_API(regulator, api) = {
.enable = regulator_rpi_pico_enable,
.disable = regulator_rpi_pico_disable,
.count_voltages = regulator_rpi_pico_count_voltages,
Expand Down

0 comments on commit 7fdf15b

Please sign in to comment.