Skip to content

Commit 50011ca

Browse files
krzkbroonie
authored andcommitted
regulator: bd96801: 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-5-eeec378144d4@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7a7e1ed commit 50011ca

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/regulator/bd96801-regulator.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,12 @@ static int ldo_map_notif(int irq, struct regulator_irq_data *rid,
337337
int i;
338338

339339
for (i = 0; i < rid->num_states; i++) {
340-
struct bd96801_regulator_data *rdata;
340+
const struct bd96801_regulator_data *rdata;
341341
struct regulator_dev *rdev;
342342

343343
rdev = rid->states[i].rdev;
344-
rdata = container_of(rdev->desc, struct bd96801_regulator_data,
345-
desc);
344+
rdata = container_of_const(rdev->desc, struct bd96801_regulator_data,
345+
desc);
346346
rid->states[i].notifs = regulator_err2notif(rdata->ldo_errs);
347347
rid->states[i].errors = rdata->ldo_errs;
348348
*dev_mask |= BIT(i);
@@ -354,9 +354,9 @@ static int bd96801_list_voltage_lr(struct regulator_dev *rdev,
354354
unsigned int selector)
355355
{
356356
int voltage;
357-
struct bd96801_regulator_data *data;
357+
const struct bd96801_regulator_data *data;
358358

359-
data = container_of(rdev->desc, struct bd96801_regulator_data, desc);
359+
data = container_of_const(rdev->desc, struct bd96801_regulator_data, desc);
360360

361361
/*
362362
* The BD096801 has voltage setting in two registers. One giving the

0 commit comments

Comments
 (0)