From: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Samuel Kayode <samkay014@gmail.com>,
Matti Vaittinen <mazziesaccount@gmail.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, imx@lists.linux.dev,
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Subject: [PATCH 7/8] regulator: pca9450: Constify pointers to 'regulator_desc' wrap struct
Date: Wed, 26 Nov 2025 17:58:50 +0100 [thread overview]
Message-ID: <20251126-container-of-const-regulator-v1-7-eeec378144d4@oss.qualcomm.com> (raw)
In-Reply-To: <20251126-container-of-const-regulator-v1-0-eeec378144d4@oss.qualcomm.com>
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>
---
drivers/regulator/pca9450-regulator.c | 8 ++++----
1 file 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;
--
2.48.1
next prev parent reply other threads:[~2025-11-26 16:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 16:58 [PATCH 0/8] regulator: Use container_of_const() when all types are const Krzysztof Kozlowski
2025-11-26 16:58 ` [PATCH 1/8] " Krzysztof Kozlowski
2025-11-26 17:33 ` Mark Brown
2025-11-26 17:37 ` Krzysztof Kozlowski
2025-11-26 18:45 ` Mark Brown
2025-11-26 16:58 ` [PATCH 2/8] regulator: bd71815: Constify pointers to 'regulator_desc' wrap struct Krzysztof Kozlowski
2025-11-26 16:58 ` [PATCH 3/8] regulator: bd71828: " Krzysztof Kozlowski
2025-11-26 16:58 ` [PATCH 4/8] regulator: bd718x7: " Krzysztof Kozlowski
2025-11-26 16:58 ` [PATCH 5/8] regulator: bd96801: " Krzysztof Kozlowski
2025-11-26 16:58 ` [PATCH 6/8] regulator: mt6358: " Krzysztof Kozlowski
2025-11-26 16:58 ` Krzysztof Kozlowski [this message]
2025-11-26 16:58 ` [PATCH 8/8] regulator: pf9453: " Krzysztof Kozlowski
2025-11-26 22:05 ` [PATCH 0/8] regulator: Use container_of_const() when all types are const Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251126-container-of-const-regulator-v1-7-eeec378144d4@oss.qualcomm.com \
--to=krzysztof.kozlowski@oss.qualcomm.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=brgl@kernel.org \
--cc=broonie@kernel.org \
--cc=imx@lists.linux.dev \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mazziesaccount@gmail.com \
--cc=samkay014@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).