[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251126-container-of-const-regulator-v2-7-7ad3408d6f29@oss.qualcomm.com>
Date: Wed, 26 Nov 2025 18:40:11 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
To: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Bartosz Golaszewski <brgl@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Samuel Kayode <samkay014@...il.com>,
Matti Vaittinen <mazziesaccount@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, imx@...ts.linux.dev,
Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
Subject: [PATCH v2 7/8] 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@....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
Powered by blists - more mailing lists