summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2018-01-02 08:28:02 -0500
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-01-08 12:40:46 -0500
commita488ca6e707b07018633200b29e2de568bdd55cb (patch)
tree74129a533f568637be76464afc70050f5bfda6b2 /drivers/power
parent31381042a614034386abb7fe7efeef392563e3b2 (diff)
power: supply: account for const type of of_device_id.data
This driver creates two const structures that it stores in the data field of an of_device_id array. The data field of an of_device_id structure has type const void *, so there is no need for a const-discarding cast when putting const values into such a structure. Furthermore, adding const to the declaration of the location that receives a const value from such a field ensures that the compiler will continue to check that the value is not modified. The const-discarding cast on the extraction from the data field is thus no longer needed. Done using Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/axp20x_ac_power.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/power/supply/axp20x_ac_power.c b/drivers/power/supply/axp20x_ac_power.c
index 38f4e87cf24d..0771f951b11f 100644
--- a/drivers/power/supply/axp20x_ac_power.c
+++ b/drivers/power/supply/axp20x_ac_power.c
@@ -159,7 +159,7 @@ static int axp20x_ac_power_probe(struct platform_device *pdev)
159 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); 159 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
160 struct power_supply_config psy_cfg = {}; 160 struct power_supply_config psy_cfg = {};
161 struct axp20x_ac_power *power; 161 struct axp20x_ac_power *power;
162 struct axp_data *axp_data; 162 const struct axp_data *axp_data;
163 static const char * const irq_names[] = { "ACIN_PLUGIN", "ACIN_REMOVAL", 163 static const char * const irq_names[] = { "ACIN_PLUGIN", "ACIN_REMOVAL",
164 NULL }; 164 NULL };
165 int i, irq, ret; 165 int i, irq, ret;
@@ -176,7 +176,7 @@ static int axp20x_ac_power_probe(struct platform_device *pdev)
176 if (!power) 176 if (!power)
177 return -ENOMEM; 177 return -ENOMEM;
178 178
179 axp_data = (struct axp_data *)of_device_get_match_data(&pdev->dev); 179 axp_data = of_device_get_match_data(&pdev->dev);
180 180
181 if (axp_data->acin_adc) { 181 if (axp_data->acin_adc) {
182 power->acin_v = devm_iio_channel_get(&pdev->dev, "acin_v"); 182 power->acin_v = devm_iio_channel_get(&pdev->dev, "acin_v");
@@ -230,10 +230,10 @@ static int axp20x_ac_power_probe(struct platform_device *pdev)
230static const struct of_device_id axp20x_ac_power_match[] = { 230static const struct of_device_id axp20x_ac_power_match[] = {
231 { 231 {
232 .compatible = "x-powers,axp202-ac-power-supply", 232 .compatible = "x-powers,axp202-ac-power-supply",
233 .data = (void *)&axp20x_data, 233 .data = &axp20x_data,
234 }, { 234 }, {
235 .compatible = "x-powers,axp221-ac-power-supply", 235 .compatible = "x-powers,axp221-ac-power-supply",
236 .data = (void *)&axp22x_data, 236 .data = &axp22x_data,
237 }, { /* sentinel */ } 237 }, { /* sentinel */ }
238}; 238};
239MODULE_DEVICE_TABLE(of, axp20x_ac_power_match); 239MODULE_DEVICE_TABLE(of, axp20x_ac_power_match);