diff options
Diffstat (limited to 'drivers/regulator/act8865-regulator.c')
-rw-r--r-- | drivers/regulator/act8865-regulator.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index 084cc0819a52..b92d7dd01a18 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #define ACT8865_VOLTAGE_NUM 64 | 62 | #define ACT8865_VOLTAGE_NUM 64 |
63 | 63 | ||
64 | struct act8865 { | 64 | struct act8865 { |
65 | struct regulator_dev *rdev[ACT8865_REG_NUM]; | ||
66 | struct regmap *regmap; | 65 | struct regmap *regmap; |
67 | }; | 66 | }; |
68 | 67 | ||
@@ -213,7 +212,7 @@ static int act8865_pdata_from_dt(struct device *dev, | |||
213 | struct device_node *np; | 212 | struct device_node *np; |
214 | struct act8865_regulator_data *regulator; | 213 | struct act8865_regulator_data *regulator; |
215 | 214 | ||
216 | np = of_find_node_by_name(dev->of_node, "regulators"); | 215 | np = of_get_child_by_name(dev->of_node, "regulators"); |
217 | if (!np) { | 216 | if (!np) { |
218 | dev_err(dev, "missing 'regulators' subnode in DT\n"); | 217 | dev_err(dev, "missing 'regulators' subnode in DT\n"); |
219 | return -EINVAL; | 218 | return -EINVAL; |
@@ -221,17 +220,15 @@ static int act8865_pdata_from_dt(struct device *dev, | |||
221 | 220 | ||
222 | matched = of_regulator_match(dev, np, | 221 | matched = of_regulator_match(dev, np, |
223 | act8865_matches, ARRAY_SIZE(act8865_matches)); | 222 | act8865_matches, ARRAY_SIZE(act8865_matches)); |
223 | of_node_put(np); | ||
224 | if (matched <= 0) | 224 | if (matched <= 0) |
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) * | 228 | sizeof(struct act8865_regulator_data) * |
229 | ARRAY_SIZE(act8865_matches), 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", | ||
232 | __func__); | ||
233 | return -ENOMEM; | 231 | return -ENOMEM; |
234 | } | ||
235 | 232 | ||
236 | pdata->num_regulators = matched; | 233 | pdata->num_regulators = matched; |
237 | regulator = pdata->regulators; | 234 | regulator = pdata->regulators; |
@@ -258,7 +255,7 @@ static inline int act8865_pdata_from_dt(struct device *dev, | |||
258 | static int act8865_pmic_probe(struct i2c_client *client, | 255 | static int act8865_pmic_probe(struct i2c_client *client, |
259 | const struct i2c_device_id *i2c_id) | 256 | const struct i2c_device_id *i2c_id) |
260 | { | 257 | { |
261 | struct regulator_dev **rdev; | 258 | struct regulator_dev *rdev; |
262 | struct device *dev = &client->dev; | 259 | struct device *dev = &client->dev; |
263 | struct act8865_platform_data *pdata = dev_get_platdata(dev); | 260 | struct act8865_platform_data *pdata = dev_get_platdata(dev); |
264 | struct regulator_config config = { }; | 261 | struct regulator_config config = { }; |
@@ -292,8 +289,6 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
292 | if (!act8865) | 289 | if (!act8865) |
293 | return -ENOMEM; | 290 | return -ENOMEM; |
294 | 291 | ||
295 | rdev = act8865->rdev; | ||
296 | |||
297 | act8865->regmap = devm_regmap_init_i2c(client, &act8865_regmap_config); | 292 | act8865->regmap = devm_regmap_init_i2c(client, &act8865_regmap_config); |
298 | if (IS_ERR(act8865->regmap)) { | 293 | if (IS_ERR(act8865->regmap)) { |
299 | error = PTR_ERR(act8865->regmap); | 294 | error = PTR_ERR(act8865->regmap); |
@@ -313,12 +308,12 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
313 | config.driver_data = act8865; | 308 | config.driver_data = act8865; |
314 | config.regmap = act8865->regmap; | 309 | config.regmap = act8865->regmap; |
315 | 310 | ||
316 | rdev[i] = devm_regulator_register(&client->dev, | 311 | rdev = devm_regulator_register(&client->dev, &act8865_reg[i], |
317 | &act8865_reg[i], &config); | 312 | &config); |
318 | if (IS_ERR(rdev[i])) { | 313 | if (IS_ERR(rdev)) { |
319 | dev_err(dev, "failed to register %s\n", | 314 | dev_err(dev, "failed to register %s\n", |
320 | act8865_reg[id].name); | 315 | act8865_reg[id].name); |
321 | return PTR_ERR(rdev[i]); | 316 | return PTR_ERR(rdev); |
322 | } | 317 | } |
323 | } | 318 | } |
324 | 319 | ||