[PATCH 11/17] regulator: mtk-dvfsrc: Constify static data
Krzysztof Kozlowski
krzysztof.kozlowski at linaro.org
Mon Sep 9 06:51:22 PDT 2024
Driver does not modify static data with regulator description (struct
regulator_desc), so make it const for code safety.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
---
Have in mind that to compile this code, you need pending (off-tree)
patches, which I applied.
---
drivers/regulator/mtk-dvfsrc-regulator.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/regulator/mtk-dvfsrc-regulator.c b/drivers/regulator/mtk-dvfsrc-regulator.c
index 9bf4163221f1..f5662c569464 100644
--- a/drivers/regulator/mtk-dvfsrc-regulator.c
+++ b/drivers/regulator/mtk-dvfsrc-regulator.c
@@ -19,7 +19,7 @@ enum dvfsrc_regulator_id {
};
struct dvfsrc_regulator_pdata {
- struct regulator_desc *descs;
+ const struct regulator_desc *descs;
u32 size;
};
@@ -107,7 +107,7 @@ static const unsigned int mt6873_voltages[] = {
725000,
};
-static struct regulator_desc mt6873_regulators[] = {
+static const struct regulator_desc mt6873_regulators[] = {
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt6873_voltages),
MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt6873_voltages),
};
@@ -122,7 +122,7 @@ static const unsigned int mt8183_voltages[] = {
800000,
};
-static struct regulator_desc mt8183_regulators[] = {
+static const struct regulator_desc mt8183_regulators[] = {
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8183_voltages),
};
@@ -138,7 +138,7 @@ static const unsigned int mt8195_voltages[] = {
750000,
};
-static struct regulator_desc mt8195_regulators[] = {
+static const struct regulator_desc mt8195_regulators[] = {
MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8195_voltages),
MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt8195_voltages),
};
@@ -159,7 +159,7 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev)
return -EINVAL;
for (i = 0; i < pdata->size; i++) {
- struct regulator_desc *vrdesc = &pdata->descs[i];
+ const struct regulator_desc *vrdesc = &pdata->descs[i];
struct regulator_dev *rdev;
rdev = devm_regulator_register(&pdev->dev, vrdesc, &config);
--
2.43.0
More information about the linux-arm-kernel
mailing list