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

regulator: da9052: Constify static data

Driver does not modify static data with regulators description (struct
da9052_regulator_info), so make it const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240909-regulator-const-v1-1-8934704a5787@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
9653007e 63a68ee1

+11 -11
+11 -11
drivers/regulator/da9052-regulator.c
··· 67 67 68 68 struct da9052_regulator { 69 69 struct da9052 *da9052; 70 - struct da9052_regulator_info *info; 70 + const struct da9052_regulator_info *info; 71 71 struct regulator_dev *rdev; 72 72 }; 73 73 74 - static int verify_range(struct da9052_regulator_info *info, 74 + static int verify_range(const struct da9052_regulator_info *info, 75 75 int min_uV, int max_uV) 76 76 { 77 77 if (min_uV > info->max_uV || max_uV < info->min_uV) ··· 151 151 unsigned int selector) 152 152 { 153 153 struct da9052_regulator *regulator = rdev_get_drvdata(rdev); 154 - struct da9052_regulator_info *info = regulator->info; 154 + const struct da9052_regulator_info *info = regulator->info; 155 155 int id = rdev_get_id(rdev); 156 156 int volt_uV; 157 157 ··· 175 175 int min_uV, int max_uV) 176 176 { 177 177 struct da9052_regulator *regulator = rdev_get_drvdata(rdev); 178 - struct da9052_regulator_info *info = regulator->info; 178 + const struct da9052_regulator_info *info = regulator->info; 179 179 int id = rdev_get_id(rdev); 180 180 int ret, sel; 181 181 ··· 206 206 unsigned int selector) 207 207 { 208 208 struct da9052_regulator *regulator = rdev_get_drvdata(rdev); 209 - struct da9052_regulator_info *info = regulator->info; 209 + const struct da9052_regulator_info *info = regulator->info; 210 210 int id = rdev_get_id(rdev); 211 211 int ret; 212 212 ··· 237 237 unsigned int new_sel) 238 238 { 239 239 struct da9052_regulator *regulator = rdev_get_drvdata(rdev); 240 - struct da9052_regulator_info *info = regulator->info; 240 + const struct da9052_regulator_info *info = regulator->info; 241 241 int id = rdev_get_id(rdev); 242 242 int ret = 0; 243 243 ··· 327 327 .activate_bit = (abits),\ 328 328 } 329 329 330 - static struct da9052_regulator_info da9052_regulator_info[] = { 330 + static const struct da9052_regulator_info da9052_regulator_info[] = { 331 331 DA9052_DCDC(BUCK1, buck1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO), 332 332 DA9052_DCDC(BUCK2, buck2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO), 333 333 DA9052_DCDC(BUCK3, buck3, 25, 950, 2525, 6, 6, DA9052_SUPPLY_VBMEMGO), ··· 344 344 DA9052_LDO(LDO10, ldo10, 50, 1200, 3600, 6, 6, 0), 345 345 }; 346 346 347 - static struct da9052_regulator_info da9053_regulator_info[] = { 347 + static const struct da9052_regulator_info da9053_regulator_info[] = { 348 348 DA9052_DCDC(BUCK1, buck1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO), 349 349 DA9052_DCDC(BUCK2, buck2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO), 350 350 DA9052_DCDC(BUCK3, buck3, 25, 950, 2525, 6, 6, DA9052_SUPPLY_VBMEMGO), ··· 361 361 DA9052_LDO(LDO10, ldo10, 50, 1200, 3600, 6, 6, 0), 362 362 }; 363 363 364 - static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id, 365 - int id) 364 + static inline const struct da9052_regulator_info *find_regulator_info(u8 chip_id, 365 + int id) 366 366 { 367 - struct da9052_regulator_info *info; 367 + const struct da9052_regulator_info *info; 368 368 int i; 369 369 370 370 switch (chip_id) {