Skip to content

Commit 788915a

Browse files
krzkbroonie
authored andcommitted
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>
1 parent ac1530c commit 788915a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/regulator/bd71815-regulator.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ static int set_hw_dvs_levels(struct device_node *np,
173173
const struct regulator_desc *desc,
174174
struct regulator_config *cfg)
175175
{
176-
struct bd71815_regulator *data;
176+
const struct bd71815_regulator *data;
177177

178-
data = container_of(desc, struct bd71815_regulator, desc);
178+
data = container_of_const(desc, struct bd71815_regulator, desc);
179179
return rohm_regulator_set_dvs_levels(data->dvs, np, desc, cfg->regmap);
180180
}
181181

@@ -195,10 +195,10 @@ static int buck12_set_hw_dvs_levels(struct device_node *np,
195195
const struct regulator_desc *desc,
196196
struct regulator_config *cfg)
197197
{
198-
struct bd71815_regulator *data;
198+
const struct bd71815_regulator *data;
199199
int ret = 0, val;
200200

201-
data = container_of(desc, struct bd71815_regulator, desc);
201+
data = container_of_const(desc, struct bd71815_regulator, desc);
202202

203203
if (of_property_present(np, "rohm,dvs-run-voltage") ||
204204
of_property_present(np, "rohm,dvs-suspend-voltage") ||

0 commit comments

Comments
 (0)