diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-10 23:53:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-10 23:53:48 -0400 |
commit | 68d7d768c684a74487dfbdbf100432685e54dc0b (patch) | |
tree | a8613dd81b631e3fd53472c4a2538e984a0f478c /drivers | |
parent | cfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff) | |
parent | 0bdc81e4e944781a2bcc971f9e3cf24ac7030939 (diff) |
Merge tag 'regulator-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown:
"A couple of small fixes, plus larger fixes for the gpio-regulator
driver the most recent changes for which had apparently not been
tested at all in -next (or elsewhere from the looks of it)."
* tag 'regulator-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
regulator: core: Properly handle the case min_uV < rdev->desc->min_uV in map_voltage_linear
regulator: max8649: fix missing regmap in rdev
regulator: gpio-regulator: populate selector from set_voltage
regulator: gpio-regulator: Fix finding of smallest value
regulator: gpio-regulator: do not pass drvdata pointer as reference
regulator: anatop: Use correct __devexit_p annotation
regulator: palmas: Fix wrong kfree calls
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 2 | ||||
-rw-r--r-- | drivers/regulator/core.c | 3 | ||||
-rw-r--r-- | drivers/regulator/gpio-regulator.c | 16 | ||||
-rw-r--r-- | drivers/regulator/max8649.c | 1 | ||||
-rw-r--r-- | drivers/regulator/palmas-regulator.c | 7 |
5 files changed, 15 insertions, 14 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 3660bace123c..e82e7eaac0f1 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -224,7 +224,7 @@ static struct platform_driver anatop_regulator_driver = { | |||
224 | .of_match_table = of_anatop_regulator_match_tbl, | 224 | .of_match_table = of_anatop_regulator_match_tbl, |
225 | }, | 225 | }, |
226 | .probe = anatop_regulator_probe, | 226 | .probe = anatop_regulator_probe, |
227 | .remove = anatop_regulator_remove, | 227 | .remove = __devexit_p(anatop_regulator_remove), |
228 | }; | 228 | }; |
229 | 229 | ||
230 | static int __init anatop_regulator_init(void) | 230 | static int __init anatop_regulator_init(void) |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 7584a74eec8a..09a737c868b5 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2050,6 +2050,9 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev, | |||
2050 | return -EINVAL; | 2050 | return -EINVAL; |
2051 | } | 2051 | } |
2052 | 2052 | ||
2053 | if (min_uV < rdev->desc->min_uV) | ||
2054 | min_uV = rdev->desc->min_uV; | ||
2055 | |||
2053 | ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step); | 2056 | ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step); |
2054 | if (ret < 0) | 2057 | if (ret < 0) |
2055 | return ret; | 2058 | return ret; |
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 9997d7aaca84..242851a4c1a6 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c | |||
@@ -101,16 +101,20 @@ static int gpio_regulator_get_value(struct regulator_dev *dev) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | static int gpio_regulator_set_value(struct regulator_dev *dev, | 103 | static int gpio_regulator_set_value(struct regulator_dev *dev, |
104 | int min, int max) | 104 | int min, int max, unsigned *selector) |
105 | { | 105 | { |
106 | struct gpio_regulator_data *data = rdev_get_drvdata(dev); | 106 | struct gpio_regulator_data *data = rdev_get_drvdata(dev); |
107 | int ptr, target, state, best_val = INT_MAX; | 107 | int ptr, target = 0, state, best_val = INT_MAX; |
108 | 108 | ||
109 | for (ptr = 0; ptr < data->nr_states; ptr++) | 109 | for (ptr = 0; ptr < data->nr_states; ptr++) |
110 | if (data->states[ptr].value < best_val && | 110 | if (data->states[ptr].value < best_val && |
111 | data->states[ptr].value >= min && | 111 | data->states[ptr].value >= min && |
112 | data->states[ptr].value <= max) | 112 | data->states[ptr].value <= max) { |
113 | target = data->states[ptr].gpios; | 113 | target = data->states[ptr].gpios; |
114 | best_val = data->states[ptr].value; | ||
115 | if (selector) | ||
116 | *selector = ptr; | ||
117 | } | ||
114 | 118 | ||
115 | if (best_val == INT_MAX) | 119 | if (best_val == INT_MAX) |
116 | return -EINVAL; | 120 | return -EINVAL; |
@@ -128,7 +132,7 @@ static int gpio_regulator_set_voltage(struct regulator_dev *dev, | |||
128 | int min_uV, int max_uV, | 132 | int min_uV, int max_uV, |
129 | unsigned *selector) | 133 | unsigned *selector) |
130 | { | 134 | { |
131 | return gpio_regulator_set_value(dev, min_uV, max_uV); | 135 | return gpio_regulator_set_value(dev, min_uV, max_uV, selector); |
132 | } | 136 | } |
133 | 137 | ||
134 | static int gpio_regulator_list_voltage(struct regulator_dev *dev, | 138 | static int gpio_regulator_list_voltage(struct regulator_dev *dev, |
@@ -145,7 +149,7 @@ static int gpio_regulator_list_voltage(struct regulator_dev *dev, | |||
145 | static int gpio_regulator_set_current_limit(struct regulator_dev *dev, | 149 | static int gpio_regulator_set_current_limit(struct regulator_dev *dev, |
146 | int min_uA, int max_uA) | 150 | int min_uA, int max_uA) |
147 | { | 151 | { |
148 | return gpio_regulator_set_value(dev, min_uA, max_uA); | 152 | return gpio_regulator_set_value(dev, min_uA, max_uA, NULL); |
149 | } | 153 | } |
150 | 154 | ||
151 | static struct regulator_ops gpio_regulator_voltage_ops = { | 155 | static struct regulator_ops gpio_regulator_voltage_ops = { |
@@ -286,7 +290,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev) | |||
286 | 290 | ||
287 | cfg.dev = &pdev->dev; | 291 | cfg.dev = &pdev->dev; |
288 | cfg.init_data = config->init_data; | 292 | cfg.init_data = config->init_data; |
289 | cfg.driver_data = &drvdata; | 293 | cfg.driver_data = drvdata; |
290 | 294 | ||
291 | drvdata->dev = regulator_register(&drvdata->desc, &cfg); | 295 | drvdata->dev = regulator_register(&drvdata->desc, &cfg); |
292 | if (IS_ERR(drvdata->dev)) { | 296 | if (IS_ERR(drvdata->dev)) { |
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 1f4bb80457b3..9d540cd02dab 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
@@ -259,6 +259,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, | |||
259 | config.dev = &client->dev; | 259 | config.dev = &client->dev; |
260 | config.init_data = pdata->regulator; | 260 | config.init_data = pdata->regulator; |
261 | config.driver_data = info; | 261 | config.driver_data = info; |
262 | config.regmap = info->regmap; | ||
262 | 263 | ||
263 | info->regulator = regulator_register(&dcdc_desc, &config); | 264 | info->regulator = regulator_register(&dcdc_desc, &config); |
264 | if (IS_ERR(info->regulator)) { | 265 | if (IS_ERR(info->regulator)) { |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index c4435f608df7..9b7ca90057d5 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -775,9 +775,6 @@ static __devinit int palmas_probe(struct platform_device *pdev) | |||
775 | err_unregister_regulator: | 775 | err_unregister_regulator: |
776 | while (--id >= 0) | 776 | while (--id >= 0) |
777 | regulator_unregister(pmic->rdev[id]); | 777 | regulator_unregister(pmic->rdev[id]); |
778 | kfree(pmic->rdev); | ||
779 | kfree(pmic->desc); | ||
780 | kfree(pmic); | ||
781 | return ret; | 778 | return ret; |
782 | } | 779 | } |
783 | 780 | ||
@@ -788,10 +785,6 @@ static int __devexit palmas_remove(struct platform_device *pdev) | |||
788 | 785 | ||
789 | for (id = 0; id < PALMAS_NUM_REGS; id++) | 786 | for (id = 0; id < PALMAS_NUM_REGS; id++) |
790 | regulator_unregister(pmic->rdev[id]); | 787 | regulator_unregister(pmic->rdev[id]); |
791 | |||
792 | kfree(pmic->rdev); | ||
793 | kfree(pmic->desc); | ||
794 | kfree(pmic); | ||
795 | return 0; | 788 | return 0; |
796 | } | 789 | } |
797 | 790 | ||