Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: pcap: Constify static data

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@linaro.org>
Link: https://patch.msgid.link/20240909-regulator-const-v1-12-8934704a5787@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
7f1bfca4 90b94a05

+6 -6
+6 -6
drivers/regulator/pcap-regulator.c
··· 105 105 .lowpwr = _lowpwr, \ 106 106 } 107 107 108 - static struct pcap_regulator vreg_table[] = { 108 + static const struct pcap_regulator vreg_table[] = { 109 109 VREG_INFO(V1, PCAP_REG_VREG1, 1, 2, 18, 0), 110 110 VREG_INFO(V2, PCAP_REG_VREG1, 5, 6, 19, 22), 111 111 VREG_INFO(V3, PCAP_REG_VREG1, 7, 8, 20, 23), ··· 141 141 static int pcap_regulator_set_voltage_sel(struct regulator_dev *rdev, 142 142 unsigned selector) 143 143 { 144 - struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 144 + const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 145 145 void *pcap = rdev_get_drvdata(rdev); 146 146 147 147 /* the regulator doesn't support voltage switching */ ··· 155 155 156 156 static int pcap_regulator_get_voltage_sel(struct regulator_dev *rdev) 157 157 { 158 - struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 158 + const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 159 159 void *pcap = rdev_get_drvdata(rdev); 160 160 u32 tmp; 161 161 ··· 169 169 170 170 static int pcap_regulator_enable(struct regulator_dev *rdev) 171 171 { 172 - struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 172 + const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 173 173 void *pcap = rdev_get_drvdata(rdev); 174 174 175 175 if (vreg->en == NA) ··· 180 180 181 181 static int pcap_regulator_disable(struct regulator_dev *rdev) 182 182 { 183 - struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 183 + const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 184 184 void *pcap = rdev_get_drvdata(rdev); 185 185 186 186 if (vreg->en == NA) ··· 191 191 192 192 static int pcap_regulator_is_enabled(struct regulator_dev *rdev) 193 193 { 194 - struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 194 + const struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)]; 195 195 void *pcap = rdev_get_drvdata(rdev); 196 196 u32 tmp; 197 197