regulator: cros-ec: Constify cros_ec_regulator_voltage_ops
PATCH 1/1 regulator: cros-ec: Constify cros_ec_regulator_voltage_ops
It is never modified, so make it const to allow the compiler to put it in read-only memory.
--- drivers/regulator/cros-ec-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/cros-ec-regulator.c +1 -1
@@ -142,7 +142,7 @@ static int cros_ec_regulator_set_voltage(struct regulator_dev *dev, int min_uV, sizeof(cmd), NULL, 0); } -static struct regulator_ops cros_ec_regulator_voltage_ops = { +static const struct regulator_ops cros_ec_regulator_voltage_ops = { .enable = cros_ec_regulator_enable, .disable = cros_ec_regulator_disable, .is_enabled = cros_ec_regulator_is_enabled,
Signature · 1 line
2.27.0
PATCH 1/1 const_structs.checkpatch: Add regulator_ops
Add regulator_ops to expected to be const list
---
scripts/const_structs.checkpatch +1 -0
@@ -44,6 +44,7 @@ platform_hibernation_ops platform_suspend_ops proto_ops regmap_access_table +regulator_ops rpc_pipe_ops rtc_class_ops sd_desc
Re: [PATCH] regulator: Use const regulator_ops when possible
Add const to declaration of struct regulator_ops where appropriate.
---
Compiled/untested
drivers/regulator/dummy.c | 2 +- drivers/regulator/fixed.c | 4 ++-- drivers/regulator/pca9450-regulator.c | 6 +++--- drivers/regulator/stw481x-vmmc.c | 2 +- drivers/regulator/tps51632-regulator.c | 2 +- drivers/regulator/tps6105x-regulator.c | 2 +- drivers/regulator/tps62360-regulator.c | 2 +- drivers/regulator/tps65086-regulator.c | 4 ++-- drivers/regulator/tps65090-regulator.c | 8 ++++---- drivers/regulator/tps6586x-regulator.c | 8 ++++---- drivers/regulator/tps65910-regulator.c | 10 +++++----- drivers/regulator/tps65912-regulator.c | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-)
drivers/regulator/dummy.c +1 -1
@@ -27,7 +27,7 @@ static struct regulator_init_data dummy_initdata = { }, }; -static struct regulator_ops dummy_ops; +static const struct regulator_ops dummy_ops;static const struct regulator_desc dummy_desc = { .name ="regulator-dummy" ,
drivers/regulator/fixed.c +2 -2
@@ -131,10 +131,10 @@ of_get_fixed_voltage_config(struct device *dev,return config; } -static struct regulator_ops fixed_voltage_ops = { +static const struct regulator_ops fixed_voltage_ops = { }; -static struct regulator_ops fixed_voltage_clkenabled_ops = { +static const struct regulator_ops fixed_voltage_clkenabled_ops = { .enable = reg_clock_enable, .disable = reg_clock_disable, .is_enabled = reg_clock_is_enabled,
drivers/regulator/pca9450-regulator.c +3 -3
@@ -90,7 +90,7 @@ static int pca9450_dvs_set_ramp_delay(struct regulator_dev *rdev, BUCK1_RAMP_MASK, ramp_value << 6); } -static struct regulator_ops pca9450_dvs_buck_regulator_ops = { +static const struct regulator_ops pca9450_dvs_buck_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
@@ -101,7 +101,7 @@ static struct regulator_ops pca9450_dvs_buck_regulator_ops = { .set_ramp_delay = pca9450_dvs_set_ramp_delay, }; -static struct regulator_ops pca9450_buck_regulator_ops = { +static const struct regulator_ops pca9450_buck_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
@@ -111,7 +111,7 @@ static struct regulator_ops pca9450_buck_regulator_ops = { .set_voltage_time_sel = regulator_set_voltage_time_sel, }; -static struct regulator_ops pca9450_ldo_regulator_ops = { +static const struct regulator_ops pca9450_ldo_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
drivers/regulator/stw481x-vmmc.c +1 -1
@@ -27,7 +27,7 @@ static const unsigned int stw481x_vmmc_voltages[] = { 3300000, }; -static struct regulator_ops stw481x_vmmc_ops = { +static const struct regulator_ops stw481x_vmmc_ops = { .list_voltage = regulator_list_voltage_table, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
drivers/regulator/tps51632-regulator.c +1 -1
@@ -108,7 +108,7 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,return ret; } -static struct regulator_ops tps51632_dcdc_ops = { +static const struct regulator_ops tps51632_dcdc_ops = { .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = regulator_list_voltage_linear,
drivers/regulator/tps6105x-regulator.c +1 -1
@@ -26,7 +26,7 @@ static const unsigned int tps6105x_voltages[] = { 5000000, /* There is an additional 5V */ }; -static struct regulator_ops tps6105x_regulator_ops = { +static const struct regulator_ops tps6105x_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
drivers/regulator/tps62360-regulator.c +1 -1
@@ -233,7 +233,7 @@ static unsigned int tps62360_get_mode(struct regulator_dev *rdev) REGULATOR_MODE_FAST :REGULATOR_MODE_NORMAL ; } -static struct regulator_ops tps62360_dcdc_ops = { +static const struct regulator_ops tps62360_dcdc_ops = { .get_voltage_sel = tps62360_dcdc_get_voltage_sel, .set_voltage_sel = tps62360_dcdc_set_voltage_sel, .list_voltage = regulator_list_voltage_linear,
drivers/regulator/tps65086-regulator.c +2 -2
@@ -101,7 +101,7 @@ static const struct linear_range tps65086_ldoa23_ranges[] = { };/* Operations permitted on regulators */ -static struct regulator_ops reg_ops = { +static const struct regulator_ops reg_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
@@ -112,7 +112,7 @@ static struct regulator_ops reg_ops = { };/* Operations permitted on load switches */ -static struct regulator_ops switch_ops = { +static const struct regulator_ops switch_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
drivers/regulator/tps65090-regulator.c +4 -4
@@ -47,7 +47,7 @@ struct tps65090_regulator {int overcurrent_wait; }; -static struct regulator_ops tps65090_ext_control_ops = { +static const struct regulator_ops tps65090_ext_control_ops = { };/**
@@ -167,19 +167,19 @@ static int tps65090_fet_enable(struct regulator_dev *rdev)return ret; } -static struct regulator_ops tps65090_reg_control_ops = { +static const struct regulator_ops tps65090_reg_control_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, }; -static struct regulator_ops tps65090_fet_control_ops = { +static const struct regulator_ops tps65090_fet_control_ops = { .enable = tps65090_fet_enable, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, }; -static struct regulator_ops tps65090_ldo_ops = { +static const struct regulator_ops tps65090_ldo_ops = { };#define tps65090_REG_DESC (_id, _sname, _en_reg, _en_bits, _nvolt, _volt, _ops) \
drivers/regulator/tps6586x-regulator.c +4 -4
@@ -60,7 +60,7 @@ struct tps6586x_regulator {int enable_reg[2 ]; }; -static struct regulator_ops tps6586x_rw_regulator_ops = { +static const struct regulator_ops tps6586x_rw_regulator_ops = { .list_voltage = regulator_list_voltage_table, .map_voltage = regulator_map_voltage_ascend, .get_voltage_sel = regulator_get_voltage_sel_regmap,
@@ -71,7 +71,7 @@ static struct regulator_ops tps6586x_rw_regulator_ops = { .disable = regulator_disable_regmap, }; -static struct regulator_ops tps6586x_rw_linear_regulator_ops = { +static const struct regulator_ops tps6586x_rw_linear_regulator_ops = { .list_voltage = regulator_list_voltage_linear, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -81,7 +81,7 @@ static struct regulator_ops tps6586x_rw_linear_regulator_ops = { .disable = regulator_disable_regmap, }; -static struct regulator_ops tps6586x_ro_regulator_ops = { +static const struct regulator_ops tps6586x_ro_regulator_ops = { .list_voltage = regulator_list_voltage_table, .map_voltage = regulator_map_voltage_ascend, .get_voltage_sel = regulator_get_voltage_sel_regmap,
@@ -91,7 +91,7 @@ static struct regulator_ops tps6586x_ro_regulator_ops = { .disable = regulator_disable_regmap, }; -static struct regulator_ops tps6586x_sys_regulator_ops = { +static const struct regulator_ops tps6586x_sys_regulator_ops = { };static const unsigned int tps6586x_ldo0_voltages[] = {
drivers/regulator/tps65910-regulator.c +5 -5
@@ -757,7 +757,7 @@ static int tps65911_list_voltage(struct regulator_dev *dev, unsigned selector) }/* Regulator ops (except VRTC) */ -static struct regulator_ops tps65910_ops_dcdc = { +static const struct regulator_ops tps65910_ops_dcdc = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
@@ -770,7 +770,7 @@ static struct regulator_ops tps65910_ops_dcdc = { .map_voltage = regulator_map_voltage_ascend, }; -static struct regulator_ops tps65910_ops_vdd3 = { +static const struct regulator_ops tps65910_ops_vdd3 = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
@@ -781,7 +781,7 @@ static struct regulator_ops tps65910_ops_vdd3 = { .map_voltage = regulator_map_voltage_ascend, }; -static struct regulator_ops tps65910_ops_vbb = { +static const struct regulator_ops tps65910_ops_vbb = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
@@ -793,7 +793,7 @@ static struct regulator_ops tps65910_ops_vbb = { .map_voltage = regulator_map_voltage_iterate, }; -static struct regulator_ops tps65910_ops = { +static const struct regulator_ops tps65910_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
@@ -805,7 +805,7 @@ static struct regulator_ops tps65910_ops = { .map_voltage = regulator_map_voltage_ascend, }; -static struct regulator_ops tps65911_ops = { +static const struct regulator_ops tps65911_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
drivers/regulator/tps65912-regulator.c +2 -2
@@ -57,7 +57,7 @@ static const struct linear_range tps65912_ldo_ranges[] = { };/* Operations permitted on DCDCx */ -static struct regulator_ops tps65912_ops_dcdc = { +static const struct regulator_ops tps65912_ops_dcdc = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
@@ -67,7 +67,7 @@ static struct regulator_ops tps65912_ops_dcdc = { };/* Operations permitted on LDOx */ -static struct regulator_ops tps65912_ops_ldo = { +static const struct regulator_ops tps65912_ops_ldo = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,
Quoted 25 lines · Rikard Falkeborn
It is never modified, so make it const to allow the compiler to put it in read-only memory.
Signed-off-by Rikard Falkeborn <[email protected]>--- drivers/regulator/cros-ec-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/regulator/cros-ec-regulator.c +1
-2@@ -142,7 +142,7 @@ static int cros_ec_regulator_set_voltage(struct regulator_dev *dev, int min_uV, sizeof(cmd), NULL, 0); } -static struct regulator_ops cros_ec_regulator_voltage_ops = { +static const struct regulator_ops cros_ec_regulator_voltage_ops = { .enable = cros_ec_regulator_enable, .disable = cros_ec_regulator_disable, .is_enabled = cros_ec_regulator_is_enabled, --2.27.0
Mark Brown
maintainerQuoted 2 lines · Rikard Falkeborn
It is never modified, so make it const to allow the compiler to put it in read-only memory.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: cros-ec: Constify cros_ec_regulator_voltage_ops
commit: 308e65ad060dca2f0187731a7916c71521ce6c25
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark