Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: stw481x-vmmc: Constify static structs

The only usage of stw481x_vmmc_ops is to assign its address to the ops
field in the regulator_desc struct which is a const pointer.

The only usage of vmmc_regulator is to pass its address to
of_get_regulator_init_data() and devm_regulator_register(), both which
take const pointers.

Make both of them const to allow the compiler to put them in read-only
memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200913084114.8851-4-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Rikard Falkeborn and committed by
Mark Brown
9032693e 96ee75ff

+2 -2
+2 -2
drivers/regulator/stw481x-vmmc.c
··· 27 27 3300000, 28 28 }; 29 29 30 - static struct regulator_ops stw481x_vmmc_ops = { 30 + static const struct regulator_ops stw481x_vmmc_ops = { 31 31 .list_voltage = regulator_list_voltage_table, 32 32 .enable = regulator_enable_regmap, 33 33 .disable = regulator_disable_regmap, ··· 36 36 .set_voltage_sel = regulator_set_voltage_sel_regmap, 37 37 }; 38 38 39 - static struct regulator_desc vmmc_regulator = { 39 + static const struct regulator_desc vmmc_regulator = { 40 40 .name = "VMMC", 41 41 .id = 0, 42 42 .ops = &stw481x_vmmc_ops,