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

regulator: bd71815: Constify pointers to 'regulator_desc' wrap struct

Pointer to 'struct regulator_desc' is a pointer to const and the
wrapping structure (container) is not being modified, thus entire syntax
can be replaced to preferred and safer container_of_const().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20251126-container-of-const-regulator-v1-2-eeec378144d4@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
788915a2 ac1530cd

+4 -4
+4 -4
drivers/regulator/bd71815-regulator.c
··· 173 173 const struct regulator_desc *desc, 174 174 struct regulator_config *cfg) 175 175 { 176 - struct bd71815_regulator *data; 176 + const struct bd71815_regulator *data; 177 177 178 - data = container_of(desc, struct bd71815_regulator, desc); 178 + data = container_of_const(desc, struct bd71815_regulator, desc); 179 179 return rohm_regulator_set_dvs_levels(data->dvs, np, desc, cfg->regmap); 180 180 } 181 181 ··· 195 195 const struct regulator_desc *desc, 196 196 struct regulator_config *cfg) 197 197 { 198 - struct bd71815_regulator *data; 198 + const struct bd71815_regulator *data; 199 199 int ret = 0, val; 200 200 201 - data = container_of(desc, struct bd71815_regulator, desc); 201 + data = container_of_const(desc, struct bd71815_regulator, desc); 202 202 203 203 if (of_property_present(np, "rohm,dvs-run-voltage") || 204 204 of_property_present(np, "rohm,dvs-suspend-voltage") ||