regulator: tps65912: Constify static regulator_ops
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Sat, 29 Aug 2020 22:11:03 +0000 (00:11 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 1 Sep 2020 14:48:56 +0000 (15:48 +0100)
The only usage of tps65912_ops_dcdc and tps65912_ops_ldo is to assign
their address to the ops field in the regulator_desc struct, which is a
const pointer. Make 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/20200829221104.20870-8-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/tps65912-regulator.c

index 63d6bbd..b52d4f2 100644 (file)
@@ -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,