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

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>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
50011cac 7a7e1ed3

+5 -5
+5 -5
drivers/regulator/bd96801-regulator.c
··· 337 337 int i; 338 338 339 339 for (i = 0; i < rid->num_states; i++) { 340 - struct bd96801_regulator_data *rdata; 340 + const struct bd96801_regulator_data *rdata; 341 341 struct regulator_dev *rdev; 342 342 343 343 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); 346 346 rid->states[i].notifs = regulator_err2notif(rdata->ldo_errs); 347 347 rid->states[i].errors = rdata->ldo_errs; 348 348 *dev_mask |= BIT(i); ··· 354 354 unsigned int selector) 355 355 { 356 356 int voltage; 357 - struct bd96801_regulator_data *data; 357 + const struct bd96801_regulator_data *data; 358 358 359 - data = container_of(rdev->desc, struct bd96801_regulator_data, desc); 359 + data = container_of_const(rdev->desc, struct bd96801_regulator_data, desc); 360 360 361 361 /* 362 362 * The BD096801 has voltage setting in two registers. One giving the