aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenyou Yang <wenyou.yang@atmel.com>2013-12-30 20:27:52 -0500
committerMark Brown <broonie@linaro.org>2013-12-31 08:05:55 -0500
commitd04b755273683ed31043563b8a3a2716bd8aa6a9 (patch)
treef00b5e4c5b44d83a86e2d1981fcef46154e91984
parentf1de2c2f2749ba42b87a49ae57deb346301dec02 (diff)
regulator: act8865: register all regulators regardless of how many are used
As Mark pointed out, the driver should register all regulators regardless of how many are used in the system in order to aid diagnostics. But in the previous patch, only register the regulators that are used. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/regulator/act8865-regulator.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index f816ad866a43..5e3e1d270328 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -225,8 +225,8 @@ static int act8865_pdata_from_dt(struct device *dev,
225 return matched; 225 return matched;
226 226
227 pdata->regulators = devm_kzalloc(dev, 227 pdata->regulators = devm_kzalloc(dev,
228 sizeof(struct act8865_regulator_data) * matched, 228 sizeof(struct act8865_regulator_data) *
229 GFP_KERNEL); 229 ARRAY_SIZE(act8865_matches), GFP_KERNEL);
230 if (!pdata->regulators) { 230 if (!pdata->regulators) {
231 dev_err(dev, "%s: failed to allocate act8865 registor\n", 231 dev_err(dev, "%s: failed to allocate act8865 registor\n",
232 __func__); 232 __func__);
@@ -236,10 +236,7 @@ static int act8865_pdata_from_dt(struct device *dev,
236 pdata->num_regulators = matched; 236 pdata->num_regulators = matched;
237 regulator = pdata->regulators; 237 regulator = pdata->regulators;
238 238
239 for (i = 0; i < matched; i++) { 239 for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) {
240 if (!act8865_matches[i].init_data)
241 continue;
242
243 regulator->id = i; 240 regulator->id = i;
244 regulator->name = act8865_matches[i].name; 241 regulator->name = act8865_matches[i].name;
245 regulator->platform_data = act8865_matches[i].init_data; 242 regulator->platform_data = act8865_matches[i].init_data;
@@ -306,7 +303,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
306 } 303 }
307 304
308 /* Finally register devices */ 305 /* Finally register devices */
309 for (i = 0; i < pdata->num_regulators; i++) { 306 for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) {
310 307
311 id = pdata->regulators[i].id; 308 id = pdata->regulators[i].id;
312 309