[PATCH 0/8] regulator: Use container_of_const() when all types are const

Krzysztof Kozlowski posted 8 patches 5 days, 5 hours ago
There is a newer version of this series
drivers/regulator/bd71815-regulator.c    |  8 ++++----
drivers/regulator/bd71828-regulator.c    |  4 ++--
drivers/regulator/bd718x7-regulator.c    |  4 ++--
drivers/regulator/bd96801-regulator.c    | 10 +++++-----
drivers/regulator/hi6421-regulator.c     | 10 +++++-----
drivers/regulator/hi6421v530-regulator.c |  4 ++--
drivers/regulator/hi6421v600-regulator.c |  6 +++---
drivers/regulator/max77650-regulator.c   |  6 +++---
drivers/regulator/mt6315-regulator.c     |  6 +++---
drivers/regulator/mt6358-regulator.c     |  2 +-
drivers/regulator/pca9450-regulator.c    |  8 ++++----
drivers/regulator/pf1550-regulator.c     | 24 ++++++++++++------------
drivers/regulator/pf9453-regulator.c     |  4 +++-
13 files changed, 49 insertions(+), 47 deletions(-)
[PATCH 0/8] regulator: Use container_of_const() when all types are const
Posted by Krzysztof Kozlowski 5 days, 5 hours ago
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.

Best regards,
Krzysztof

---
Krzysztof Kozlowski (8):
      regulator: Use container_of_const() when all types are const
      regulator: bd71815: Constify pointers to 'regulator_desc' wrap struct
      regulator: bd71828: Constify pointers to 'regulator_desc' wrap struct
      regulator: bd718x7: Constify pointers to 'regulator_desc' wrap struct
      regulator: bd96801: Constify pointers to 'regulator_desc' wrap struct
      regulator: mt6358: Constify pointers to 'regulator_desc' wrap struct
      regulator: pca9450: Constify pointers to 'regulator_desc' wrap struct
      regulator: pf9453: Constify pointers to 'regulator_desc' wrap struct

 drivers/regulator/bd71815-regulator.c    |  8 ++++----
 drivers/regulator/bd71828-regulator.c    |  4 ++--
 drivers/regulator/bd718x7-regulator.c    |  4 ++--
 drivers/regulator/bd96801-regulator.c    | 10 +++++-----
 drivers/regulator/hi6421-regulator.c     | 10 +++++-----
 drivers/regulator/hi6421v530-regulator.c |  4 ++--
 drivers/regulator/hi6421v600-regulator.c |  6 +++---
 drivers/regulator/max77650-regulator.c   |  6 +++---
 drivers/regulator/mt6315-regulator.c     |  6 +++---
 drivers/regulator/mt6358-regulator.c     |  2 +-
 drivers/regulator/pca9450-regulator.c    |  8 ++++----
 drivers/regulator/pf1550-regulator.c     | 24 ++++++++++++------------
 drivers/regulator/pf9453-regulator.c     |  4 +++-
 13 files changed, 49 insertions(+), 47 deletions(-)
---
base-commit: 353fda3a1168e7e38ea541c14c4e858c78cd2018
change-id: 20251126-container-of-const-regulator-20e240c45b78

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Re: [PATCH 0/8] regulator: Use container_of_const() when all types are const
Posted by Mark Brown 4 days, 23 hours ago
On Wed, 26 Nov 2025 17:58:43 +0100, Krzysztof Kozlowski wrote:
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/8] regulator: Use container_of_const() when all types are const
      commit: ac1530cdea9846c6bff31827c0c4dffcbc186e6a
[2/8] regulator: bd71815: Constify pointers to 'regulator_desc' wrap struct
      commit: 788915a22bdfde0925c074056056e7d408c242d0
[3/8] regulator: bd71828: Constify pointers to 'regulator_desc' wrap struct
      commit: d02ea816cccae6c02c7c026b5a74bf99a784c9c8
[4/8] regulator: bd718x7: Constify pointers to 'regulator_desc' wrap struct
      commit: 7a7e1ed307de6cc68639f602f3fa247ec0903354
[5/8] regulator: bd96801: Constify pointers to 'regulator_desc' wrap struct
      commit: 50011cacaeb9556d65067ec8e757e3987ecf0f2b
[6/8] regulator: mt6358: Constify pointers to 'regulator_desc' wrap struct
      commit: 438e90a287c86253dbb47e7fa43c4474f91ee7eb
[7/8] regulator: pca9450: Constify pointers to 'regulator_desc' wrap struct
      commit: 03c3bdebaad23d6698a3cb8a11a915d8bdebf28f
[8/8] regulator: pf9453: Constify pointers to 'regulator_desc' wrap struct
      commit: 6341646f7225343f57c8cbcb6a4d25b3270f4111

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark