From 7fdf15b3044972ac2b7ae6b8235aadfb17ec4528 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 28 Nov 2024 20:58:01 +0100 Subject: [PATCH] drivers: regulator: Place API in iterable section Add wrapper DEVICE_API macro to all regulator_driver_api instances. Signed-off-by: Pieter De Gendt --- drivers/regulator/regulator_adp5360.c | 2 +- drivers/regulator/regulator_axp192.c | 2 +- drivers/regulator/regulator_cp9314.c | 2 +- drivers/regulator/regulator_da1469x.c | 2 +- drivers/regulator/regulator_fake.c | 2 +- drivers/regulator/regulator_fixed.c | 2 +- drivers/regulator/regulator_gpio.c | 2 +- drivers/regulator/regulator_max20335.c | 2 +- drivers/regulator/regulator_mpm54304.c | 2 +- drivers/regulator/regulator_npm1100.c | 2 +- drivers/regulator/regulator_npm1300.c | 16 +++++++++------- drivers/regulator/regulator_npm6001.c | 2 +- drivers/regulator/regulator_nxp_vref.c | 2 +- drivers/regulator/regulator_pca9420.c | 2 +- drivers/regulator/regulator_rpi_pico.c | 2 +- 15 files changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/regulator/regulator_adp5360.c b/drivers/regulator/regulator_adp5360.c index c417b6e5985845..a2fe6c88845de6 100644 --- a/drivers/regulator/regulator_adp5360.c +++ b/drivers/regulator/regulator_adp5360.c @@ -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, diff --git a/drivers/regulator/regulator_axp192.c b/drivers/regulator/regulator_axp192.c index 47ac2c11ecca85..c6e09682384bf2 100644 --- a/drivers/regulator/regulator_axp192.c +++ b/drivers/regulator/regulator_axp192.c @@ -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, diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index 83706ff20419d6..9bb775473a0a88 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -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, diff --git a/drivers/regulator/regulator_da1469x.c b/drivers/regulator/regulator_da1469x.c index 2273fe363bdef9..43fbe420d41609 100644 --- a/drivers/regulator/regulator_da1469x.c +++ b/drivers/regulator/regulator_da1469x.c @@ -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, diff --git a/drivers/regulator/regulator_fake.c b/drivers/regulator/regulator_fake.c index c2c71593c61528..3ed817d4a53d27 100644 --- a/drivers/regulator/regulator_fake.c +++ b/drivers/regulator/regulator_fake.c @@ -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, diff --git a/drivers/regulator/regulator_fixed.c b/drivers/regulator/regulator_fixed.c index 5e7151f4941bf1..cc5170b1695986 100644 --- a/drivers/regulator/regulator_fixed.c +++ b/drivers/regulator/regulator_fixed.c @@ -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, diff --git a/drivers/regulator/regulator_gpio.c b/drivers/regulator/regulator_gpio.c index d888a5fd6dcc46..dd9a4a19822db4 100644 --- a/drivers/regulator/regulator_gpio.c +++ b/drivers/regulator/regulator_gpio.c @@ -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, diff --git a/drivers/regulator/regulator_max20335.c b/drivers/regulator/regulator_max20335.c index 328e5179156ea4..9b29be253fc7f8 100644 --- a/drivers/regulator/regulator_max20335.c +++ b/drivers/regulator/regulator_max20335.c @@ -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, diff --git a/drivers/regulator/regulator_mpm54304.c b/drivers/regulator/regulator_mpm54304.c index a89ddc0ebe1c48..4e1de86b358cea 100644 --- a/drivers/regulator/regulator_mpm54304.c +++ b/drivers/regulator/regulator_mpm54304.c @@ -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, }; diff --git a/drivers/regulator/regulator_npm1100.c b/drivers/regulator/regulator_npm1100.c index 924e3a596d1a02..136065a7a70981 100644 --- a/drivers/regulator/regulator_npm1100.c +++ b/drivers/regulator/regulator_npm1100.c @@ -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, }; diff --git a/drivers/regulator/regulator_npm1300.c b/drivers/regulator/regulator_npm1300.c index da0a3aedb64175..8f0d3df8fec082 100644 --- a/drivers/regulator/regulator_npm1300.c +++ b/drivers/regulator/regulator_npm1300.c @@ -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; \ diff --git a/drivers/regulator/regulator_npm6001.c b/drivers/regulator/regulator_npm6001.c index 2ade708271adcb..b43a42635a8173 100644 --- a/drivers/regulator/regulator_npm6001.c +++ b/drivers/regulator/regulator_npm6001.c @@ -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, diff --git a/drivers/regulator/regulator_nxp_vref.c b/drivers/regulator/regulator_nxp_vref.c index dee12f6f679c34..cb0bc5e11b41f1 100644 --- a/drivers/regulator/regulator_nxp_vref.c +++ b/drivers/regulator/regulator_nxp_vref.c @@ -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, diff --git a/drivers/regulator/regulator_pca9420.c b/drivers/regulator/regulator_pca9420.c index 705d4f3a8e92b4..4837e54a45ad3f 100644 --- a/drivers/regulator/regulator_pca9420.c +++ b/drivers/regulator/regulator_pca9420.c @@ -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, diff --git a/drivers/regulator/regulator_rpi_pico.c b/drivers/regulator/regulator_rpi_pico.c index f2c0af1559e492..7ea44fb4440b67 100644 --- a/drivers/regulator/regulator_rpi_pico.c +++ b/drivers/regulator/regulator_rpi_pico.c @@ -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,