[PATCH 12/17] regulator: pcap: Constify static data

From: Krzysztof Kozlowski
Date: Mon Sep 09 2024 - 09:55:20 EST


Driver does not modify static data with regulator description (struct
pcap_regulator), so make it const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
---
drivers/regulator/pcap-regulator.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c
index 319a88412154..441c9344aef7 100644
--- a/drivers/regulator/pcap-regulator.c
+++ b/drivers/regulator/pcap-regulator.c
@@ -105,7 +105,7 @@ struct pcap_regulator {
.lowpwr = _lowpwr, \
}

-static struct pcap_regulator vreg_table[] = {
+static const struct pcap_regulator vreg_table[] = {
VREG_INFO(V1, PCAP_REG_VREG1, 1, 2, 18, 0),
VREG_INFO(V2, PCAP_REG_VREG1, 5, 6, 19, 22),
VREG_INFO(V3, PCAP_REG_VREG1, 7, 8, 20, 23),
@@ -141,7 +141,7 @@ static struct pcap_regulator vreg_table[] = {
static int pcap_regulator_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector)
{
- struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
+ const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
void *pcap = rdev_get_drvdata(rdev);

/* the regulator doesn't support voltage switching */
@@ -155,7 +155,7 @@ static int pcap_regulator_set_voltage_sel(struct regulator_dev *rdev,

static int pcap_regulator_get_voltage_sel(struct regulator_dev *rdev)
{
- struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
+ const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
void *pcap = rdev_get_drvdata(rdev);
u32 tmp;

@@ -169,7 +169,7 @@ static int pcap_regulator_get_voltage_sel(struct regulator_dev *rdev)

static int pcap_regulator_enable(struct regulator_dev *rdev)
{
- struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
+ const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
void *pcap = rdev_get_drvdata(rdev);

if (vreg->en == NA)
@@ -180,7 +180,7 @@ static int pcap_regulator_enable(struct regulator_dev *rdev)

static int pcap_regulator_disable(struct regulator_dev *rdev)
{
- struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
+ const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
void *pcap = rdev_get_drvdata(rdev);

if (vreg->en == NA)
@@ -191,7 +191,7 @@ static int pcap_regulator_disable(struct regulator_dev *rdev)

static int pcap_regulator_is_enabled(struct regulator_dev *rdev)
{
- struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
+ const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
void *pcap = rdev_get_drvdata(rdev);
u32 tmp;


--
2.43.0