diff options
author | Antti P Miettinen <amiettinen@nvidia.com> | 2011-10-07 15:03:52 +0300 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:49:26 -0800 |
commit | 311d853f77b97a7b18ff9761d9bae78d4d80e113 (patch) | |
tree | 64672641a28ba013bb552257af1495aafefb8e04 | |
parent | c6268fc51cc9c3baca2fa7eaf48742b24595925e (diff) |
regulator: tps80031: Fix set_voltage to return selector value
Current regulator_ops interface expects selector value to be returned.
Not doing so results in uninitialized variables used.
Bug 886170
Change-Id: I23e664790311e434303eb23fafd194502ae2909c
Reviewed-on: http://git-master/r/56654
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
Tested-by: Antti Miettinen <amiettinen@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Rebase-Id: R72759360aeca354ef82d0ec7431e8c9f2fcafdfb
-rw-r--r-- | drivers/regulator/tps80031-regulator.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c index 2cb0e6df1ef8..5816af324a12 100644 --- a/drivers/regulator/tps80031-regulator.c +++ b/drivers/regulator/tps80031-regulator.c @@ -287,7 +287,9 @@ static int tps80031dcdc_list_voltage(struct regulator_dev *rdev, unsigned index) } static int __tps80031_dcdc_set_voltage(struct device *parent, - struct tps80031_regulator *ri, int min_uV, int max_uV) + struct tps80031_regulator *ri, + int min_uV, int max_uV, + unsigned *selector) { int vsel = 0; int ret; @@ -364,6 +366,9 @@ static int __tps80031_dcdc_set_voltage(struct device *parent, break; } + if (selector) + *selector = vsel; + if (ri->force_reg) { if (((ri->force_reg_cache >> 6) & 0x3) == 0) { ret = tps80031_write(parent, ri->volt_id, @@ -389,7 +394,8 @@ static int tps80031dcdc_set_voltage(struct regulator_dev *rdev, { struct tps80031_regulator *ri = rdev_get_drvdata(rdev); struct device *parent = to_tps80031_dev(rdev); - return __tps80031_dcdc_set_voltage(parent, ri, min_uV, max_uV); + return __tps80031_dcdc_set_voltage(parent, ri, min_uV, max_uV, + selector); } static int tps80031dcdc_get_voltage(struct regulator_dev *rdev) @@ -493,7 +499,9 @@ static int tps80031ldo_list_voltage(struct regulator_dev *rdev, unsigned index) } static int __tps80031_ldo_set_voltage(struct device *parent, - struct tps80031_regulator *ri, int min_uV, int max_uV) + struct tps80031_regulator *ri, + int min_uV, int max_uV, + unsigned *selector) { int vsel; int ret; @@ -520,7 +528,8 @@ static int tps80031ldo_set_voltage(struct regulator_dev *rdev, struct tps80031_regulator *ri = rdev_get_drvdata(rdev); struct device *parent = to_tps80031_dev(rdev); - return __tps80031_ldo_set_voltage(parent, ri, min_uV, max_uV); + return __tps80031_ldo_set_voltage(parent, ri, min_uV, max_uV, + selector); } static int tps80031ldo_get_voltage(struct regulator_dev *rdev) @@ -826,7 +835,7 @@ static int tps80031_regulator_preinit(struct device *parent, case TPS80031_ID_SMPS4: ret = __tps80031_dcdc_set_voltage(parent, ri, tps80031_pdata->init_uV, - tps80031_pdata->init_uV); + tps80031_pdata->init_uV, 0); break; case TPS80031_ID_LDO1: @@ -841,7 +850,7 @@ static int tps80031_regulator_preinit(struct device *parent, case TPS80031_ID_VANA: ret = __tps80031_ldo_set_voltage(parent, ri, tps80031_pdata->init_uV, - tps80031_pdata->init_uV); + tps80031_pdata->init_uV, 0); break; default: ret = -EINVAL; |