Skip to content

Commit

Permalink
regulator: act8865: register all regulators regardless of how many ar…
Browse files Browse the repository at this point in the history
…e 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>
  • Loading branch information
Wenyou Yang authored and Mark Brown committed Dec 31, 2013
1 parent f1de2c2 commit d04b755
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/regulator/act8865-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ static int act8865_pdata_from_dt(struct device *dev,
return matched;

pdata->regulators = devm_kzalloc(dev,
sizeof(struct act8865_regulator_data) * matched,
GFP_KERNEL);
sizeof(struct act8865_regulator_data) *
ARRAY_SIZE(act8865_matches), GFP_KERNEL);
if (!pdata->regulators) {
dev_err(dev, "%s: failed to allocate act8865 registor\n",
__func__);
Expand All @@ -236,10 +236,7 @@ static int act8865_pdata_from_dt(struct device *dev,
pdata->num_regulators = matched;
regulator = pdata->regulators;

for (i = 0; i < matched; i++) {
if (!act8865_matches[i].init_data)
continue;

for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) {
regulator->id = i;
regulator->name = act8865_matches[i].name;
regulator->platform_data = act8865_matches[i].init_data;
Expand Down Expand Up @@ -306,7 +303,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
}

/* Finally register devices */
for (i = 0; i < pdata->num_regulators; i++) {
for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) {

id = pdata->regulators[i].id;

Expand Down

0 comments on commit d04b755

Please sign in to comment.