aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/as3711-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/as3711-regulator.c')
-rw-r--r--drivers/regulator/as3711-regulator.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/regulator/as3711-regulator.c b/drivers/regulator/as3711-regulator.c
index c77a58478cca..b47283f91e2d 100644
--- a/drivers/regulator/as3711-regulator.c
+++ b/drivers/regulator/as3711-regulator.c
@@ -191,7 +191,7 @@ static int as3711_regulator_parse_dt(struct device *dev,
191{ 191{
192 struct as3711_regulator_pdata *pdata = dev_get_platdata(dev); 192 struct as3711_regulator_pdata *pdata = dev_get_platdata(dev);
193 struct device_node *regulators = 193 struct device_node *regulators =
194 of_find_node_by_name(dev->parent->of_node, "regulators"); 194 of_get_child_by_name(dev->parent->of_node, "regulators");
195 struct of_regulator_match *match; 195 struct of_regulator_match *match;
196 int ret, i; 196 int ret, i;
197 197
@@ -221,7 +221,6 @@ static int as3711_regulator_probe(struct platform_device *pdev)
221{ 221{
222 struct as3711_regulator_pdata *pdata = dev_get_platdata(&pdev->dev); 222 struct as3711_regulator_pdata *pdata = dev_get_platdata(&pdev->dev);
223 struct as3711 *as3711 = dev_get_drvdata(pdev->dev.parent); 223 struct as3711 *as3711 = dev_get_drvdata(pdev->dev.parent);
224 struct regulator_init_data *reg_data;
225 struct regulator_config config = {.dev = &pdev->dev,}; 224 struct regulator_config config = {.dev = &pdev->dev,};
226 struct as3711_regulator *reg = NULL; 225 struct as3711_regulator *reg = NULL;
227 struct as3711_regulator *regs; 226 struct as3711_regulator *regs;
@@ -246,22 +245,14 @@ static int as3711_regulator_probe(struct platform_device *pdev)
246 245
247 regs = devm_kzalloc(&pdev->dev, AS3711_REGULATOR_NUM * 246 regs = devm_kzalloc(&pdev->dev, AS3711_REGULATOR_NUM *
248 sizeof(struct as3711_regulator), GFP_KERNEL); 247 sizeof(struct as3711_regulator), GFP_KERNEL);
249 if (!regs) { 248 if (!regs)
250 dev_err(&pdev->dev, "Memory allocation failed exiting..\n");
251 return -ENOMEM; 249 return -ENOMEM;
252 }
253 250
254 for (id = 0, ri = as3711_reg_info; id < AS3711_REGULATOR_NUM; ++id, ri++) { 251 for (id = 0, ri = as3711_reg_info; id < AS3711_REGULATOR_NUM; ++id, ri++) {
255 reg_data = pdata->init_data[id];
256
257 /* No need to register if there is no regulator data */
258 if (!reg_data)
259 continue;
260
261 reg = &regs[id]; 252 reg = &regs[id];
262 reg->reg_info = ri; 253 reg->reg_info = ri;
263 254
264 config.init_data = reg_data; 255 config.init_data = pdata->init_data[id];
265 config.driver_data = reg; 256 config.driver_data = reg;
266 config.regmap = as3711->regmap; 257 config.regmap = as3711->regmap;
267 config.of_node = of_node[id]; 258 config.of_node = of_node[id];