diff options
| author | Mark Brown <broonie@kernel.org> | 2025-11-26 21:21:57 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-11-26 21:21:57 +0000 |
| commit | c67bb84434b024fa2ae83f91bbd02457f2d2c8a6 (patch) | |
| tree | f6bd8c747bcf241fc8c65df75b83cf6dbef93190 /drivers/regulator/pca9450-regulator.c | |
| parent | fba27fe5aaf14e2aae1649a14309b77de2c9546c (diff) | |
| parent | 6341646f7225343f57c8cbcb6a4d25b3270f4111 (diff) | |
regulator: Use container_of_const() when all types are
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>:
Use container_of_const(), which is preferred over container_of(), when
the argument 'ptr' and returned pointer are already const, for better
code safety and readability.
Some drivers already have const everywhere, so container_of_const can be
directly used. In few other drivers, the final pointer can be constified
that way.
Diffstat (limited to 'drivers/regulator/pca9450-regulator.c')
| -rw-r--r-- | drivers/regulator/pca9450-regulator.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index 32780c311ccd..5fa868264250 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -249,7 +249,7 @@ static int buck_set_dvs(const struct regulator_desc *desc, } if (ret == 0) { - struct pca9450_regulator_desc *regulator = container_of(desc, + const struct pca9450_regulator_desc *regulator = container_of_const(desc, struct pca9450_regulator_desc, desc); /* Enable DVS control through PMIC_STBY_REQ for this BUCK */ @@ -263,7 +263,7 @@ static int pca9450_set_dvs_levels(struct device_node *np, const struct regulator_desc *desc, struct regulator_config *cfg) { - struct pca9450_regulator_desc *data = container_of(desc, + const struct pca9450_regulator_desc *data = container_of_const(desc, struct pca9450_regulator_desc, desc); const struct pc9450_dvs_config *dvs = &data->dvs; unsigned int reg, mask; @@ -308,7 +308,7 @@ static inline unsigned int pca9450_map_mode(unsigned int mode) static int pca9450_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) { - struct pca9450_regulator_desc *desc = container_of(rdev->desc, + const struct pca9450_regulator_desc *desc = container_of_const(rdev->desc, struct pca9450_regulator_desc, desc); const struct pc9450_dvs_config *dvs = &desc->dvs; int val; @@ -333,7 +333,7 @@ static int pca9450_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) static unsigned int pca9450_buck_get_mode(struct regulator_dev *rdev) { - struct pca9450_regulator_desc *desc = container_of(rdev->desc, + const struct pca9450_regulator_desc *desc = container_of_const(rdev->desc, struct pca9450_regulator_desc, desc); const struct pc9450_dvs_config *dvs = &desc->dvs; int ret = 0, regval; |