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/max77650-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/max77650-regulator.c')
| -rw-r--r-- | drivers/regulator/max77650-regulator.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/regulator/max77650-regulator.c b/drivers/regulator/max77650-regulator.c index 7368f54f046d..a809264c77fc 100644 --- a/drivers/regulator/max77650-regulator.c +++ b/drivers/regulator/max77650-regulator.c @@ -68,7 +68,7 @@ static int max77650_regulator_is_enabled(struct regulator_dev *rdev) struct regmap *map; int val, rv, en; - rdesc = container_of(rdev->desc, struct max77650_regulator_desc, desc); + rdesc = container_of_const(rdev->desc, struct max77650_regulator_desc, desc); map = rdev_get_regmap(rdev); rv = regmap_read(map, rdesc->regB, &val); @@ -85,7 +85,7 @@ static int max77650_regulator_enable(struct regulator_dev *rdev) const struct max77650_regulator_desc *rdesc; struct regmap *map; - rdesc = container_of(rdev->desc, struct max77650_regulator_desc, desc); + rdesc = container_of_const(rdev->desc, struct max77650_regulator_desc, desc); map = rdev_get_regmap(rdev); return regmap_update_bits(map, rdesc->regB, @@ -98,7 +98,7 @@ static int max77650_regulator_disable(struct regulator_dev *rdev) const struct max77650_regulator_desc *rdesc; struct regmap *map; - rdesc = container_of(rdev->desc, struct max77650_regulator_desc, desc); + rdesc = container_of_const(rdev->desc, struct max77650_regulator_desc, desc); map = rdev_get_regmap(rdev); return regmap_update_bits(map, rdesc->regB, |
