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

regulator: pca9450: 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-7-eeec378144d4@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
03c3bdeb 438e90a2

+4 -4
+4 -4
drivers/regulator/pca9450-regulator.c
··· 249 249 } 250 250 251 251 if (ret == 0) { 252 - struct pca9450_regulator_desc *regulator = container_of(desc, 252 + const struct pca9450_regulator_desc *regulator = container_of_const(desc, 253 253 struct pca9450_regulator_desc, desc); 254 254 255 255 /* Enable DVS control through PMIC_STBY_REQ for this BUCK */ ··· 263 263 const struct regulator_desc *desc, 264 264 struct regulator_config *cfg) 265 265 { 266 - struct pca9450_regulator_desc *data = container_of(desc, 266 + const struct pca9450_regulator_desc *data = container_of_const(desc, 267 267 struct pca9450_regulator_desc, desc); 268 268 const struct pc9450_dvs_config *dvs = &data->dvs; 269 269 unsigned int reg, mask; ··· 308 308 309 309 static int pca9450_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) 310 310 { 311 - struct pca9450_regulator_desc *desc = container_of(rdev->desc, 311 + const struct pca9450_regulator_desc *desc = container_of_const(rdev->desc, 312 312 struct pca9450_regulator_desc, desc); 313 313 const struct pc9450_dvs_config *dvs = &desc->dvs; 314 314 int val; ··· 333 333 334 334 static unsigned int pca9450_buck_get_mode(struct regulator_dev *rdev) 335 335 { 336 - struct pca9450_regulator_desc *desc = container_of(rdev->desc, 336 + const struct pca9450_regulator_desc *desc = container_of_const(rdev->desc, 337 337 struct pca9450_regulator_desc, desc); 338 338 const struct pc9450_dvs_config *dvs = &desc->dvs; 339 339 int ret = 0, regval;