diff options
author | Guodong Xu <guodong.xu@linaro.org> | 2014-08-19 06:07:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-08-19 11:36:07 -0400 |
commit | 39f5460d7f9cc57d3dd745301bf60ca5d65a6e7b (patch) | |
tree | 5a7ca3a5017af68dc4be6b3077779d49b4bafbfd | |
parent | 716845ebeb505353d900320b4a74e8330520410d (diff) |
regulator: core: add const to regulator_ops and fix build error in mc13892
Commit 272e2315fac3 ("regulator: core: add const qualifier to ops in
struct regulator_desc") introduced const qualifier to ops in regulator_desc.
This patch adds 'const' to regulator_ops vars in newly added core APIs
for v3.17-rc1:
- regulator_get_hardware_vsel_register()
- regulator_list_hardware_vsel()
This patch also fix a build error in mc13892-regulator.c due to const
regulator_desc.ops. Modification of regulator_desc.ops' member fields is not
allowed.
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/regulator/core.c | 8 | ||||
-rw-r--r-- | drivers/regulator/mc13892-regulator.c | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 1e976b6320a2..7bce7158d7e6 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2307,8 +2307,8 @@ int regulator_get_hardware_vsel_register(struct regulator *regulator, | |||
2307 | unsigned *vsel_reg, | 2307 | unsigned *vsel_reg, |
2308 | unsigned *vsel_mask) | 2308 | unsigned *vsel_mask) |
2309 | { | 2309 | { |
2310 | struct regulator_dev *rdev = regulator->rdev; | 2310 | struct regulator_dev *rdev = regulator->rdev; |
2311 | struct regulator_ops *ops = rdev->desc->ops; | 2311 | const struct regulator_ops *ops = rdev->desc->ops; |
2312 | 2312 | ||
2313 | if (ops->set_voltage_sel != regulator_set_voltage_sel_regmap) | 2313 | if (ops->set_voltage_sel != regulator_set_voltage_sel_regmap) |
2314 | return -EOPNOTSUPP; | 2314 | return -EOPNOTSUPP; |
@@ -2334,8 +2334,8 @@ EXPORT_SYMBOL_GPL(regulator_get_hardware_vsel_register); | |||
2334 | int regulator_list_hardware_vsel(struct regulator *regulator, | 2334 | int regulator_list_hardware_vsel(struct regulator *regulator, |
2335 | unsigned selector) | 2335 | unsigned selector) |
2336 | { | 2336 | { |
2337 | struct regulator_dev *rdev = regulator->rdev; | 2337 | struct regulator_dev *rdev = regulator->rdev; |
2338 | struct regulator_ops *ops = rdev->desc->ops; | 2338 | const struct regulator_ops *ops = rdev->desc->ops; |
2339 | 2339 | ||
2340 | if (selector >= rdev->desc->n_voltages) | 2340 | if (selector >= rdev->desc->n_voltages) |
2341 | return -EINVAL; | 2341 | return -EINVAL; |
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index f374fa57220f..793b662a1967 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c | |||
@@ -526,6 +526,7 @@ static unsigned int mc13892_vcam_get_mode(struct regulator_dev *rdev) | |||
526 | return REGULATOR_MODE_NORMAL; | 526 | return REGULATOR_MODE_NORMAL; |
527 | } | 527 | } |
528 | 528 | ||
529 | static struct regulator_ops mc13892_vcam_ops; | ||
529 | 530 | ||
530 | static int mc13892_regulator_probe(struct platform_device *pdev) | 531 | static int mc13892_regulator_probe(struct platform_device *pdev) |
531 | { | 532 | { |
@@ -582,10 +583,12 @@ static int mc13892_regulator_probe(struct platform_device *pdev) | |||
582 | } | 583 | } |
583 | mc13xxx_unlock(mc13892); | 584 | mc13xxx_unlock(mc13892); |
584 | 585 | ||
585 | mc13892_regulators[MC13892_VCAM].desc.ops->set_mode | 586 | /* update mc13892_vcam ops */ |
586 | = mc13892_vcam_set_mode; | 587 | memcpy(&mc13892_vcam_ops, mc13892_regulators[MC13892_VCAM].desc.ops, |
587 | mc13892_regulators[MC13892_VCAM].desc.ops->get_mode | 588 | sizeof(struct regulator_ops)); |
588 | = mc13892_vcam_get_mode; | 589 | mc13892_vcam_ops.set_mode = mc13892_vcam_set_mode, |
590 | mc13892_vcam_ops.get_mode = mc13892_vcam_get_mode, | ||
591 | mc13892_regulators[MC13892_VCAM].desc.ops = &mc13892_vcam_ops; | ||
589 | 592 | ||
590 | mc13xxx_data = mc13xxx_parse_regulators_dt(pdev, mc13892_regulators, | 593 | mc13xxx_data = mc13xxx_parse_regulators_dt(pdev, mc13892_regulators, |
591 | ARRAY_SIZE(mc13892_regulators)); | 594 | ARRAY_SIZE(mc13892_regulators)); |