aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Zhong <zyw@rock-chips.com>2014-08-25 09:37:06 -0400
committerMark Brown <broonie@linaro.org>2014-08-26 03:30:23 -0400
commitd76c333e9fe2d269c54f68747b2311a5657276e5 (patch)
treef962e8a4486bfc992da17d406235e8f25c8c6e39
parent462004f1215ccb77969004a049aa5437f34c9b06 (diff)
regulator: RK808: modify for struct rk808 change
The "dev" has been deleted from "struct rk808" in rk808 mfd driver so rk808->dev should be replaced by &client->dev here. Signed-off-by: Chris Zhong <zyw@rock-chips.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/regulator/rk808-regulator.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 4d5041ceb56a..f00d6d89c7f4 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -296,13 +296,14 @@ static struct of_regulator_match rk808_reg_matches[] = {
296 296
297static int rk808_regulator_dts(struct rk808 *rk808) 297static int rk808_regulator_dts(struct rk808 *rk808)
298{ 298{
299 struct rk808_board *pdata = rk808->pdata;
300 struct device_node *np, *reg_np; 299 struct device_node *np, *reg_np;
300 struct i2c_client *client = rk808->i2c;
301 struct rk808_board *pdata = rk808->pdata;
301 int i, ret; 302 int i, ret;
302 303
303 np = rk808->dev->of_node; 304 np = client->dev.of_node;
304 if (!np) { 305 if (!np) {
305 dev_err(rk808->dev, "could not find pmic sub-node\n"); 306 dev_err(&client->dev, "could not find pmic sub-node\n");
306 return -ENXIO; 307 return -ENXIO;
307 } 308 }
308 309
@@ -310,10 +311,10 @@ static int rk808_regulator_dts(struct rk808 *rk808)
310 if (!reg_np) 311 if (!reg_np)
311 return -ENXIO; 312 return -ENXIO;
312 313
313 ret = of_regulator_match(rk808->dev, reg_np, rk808_reg_matches, 314 ret = of_regulator_match(&client->dev, reg_np, rk808_reg_matches,
314 RK808_NUM_REGULATORS); 315 RK808_NUM_REGULATORS);
315 if (ret < 0) { 316 if (ret < 0) {
316 dev_err(rk808->dev, 317 dev_err(&client->dev,
317 "failed to parse regulator data: %d\n", ret); 318 "failed to parse regulator data: %d\n", ret);
318 return ret; 319 return ret;
319 } 320 }
@@ -333,24 +334,17 @@ static int rk808_regulator_dts(struct rk808 *rk808)
333static int rk808_regulator_probe(struct platform_device *pdev) 334static int rk808_regulator_probe(struct platform_device *pdev)
334{ 335{
335 struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent); 336 struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
336 struct rk808_board *pdata; 337 struct i2c_client *client = rk808->i2c;
338 struct rk808_board *pdata = rk808->pdata;
337 struct regulator_config config = {}; 339 struct regulator_config config = {};
338 struct regulator_dev *rk808_rdev; 340 struct regulator_dev *rk808_rdev;
339 struct regulator_init_data *reg_data; 341 struct regulator_init_data *reg_data;
340 int i = 0; 342 int i = 0;
341 int ret = 0; 343 int ret = 0;
342 344
343 dev_dbg(rk808->dev, "%s\n", __func__);
344
345 if (!rk808) {
346 dev_err(rk808->dev, "%s no rk808\n", __func__);
347 return -ENODEV;
348 }
349
350 pdata = rk808->pdata;
351 if (!pdata) { 345 if (!pdata) {
352 dev_warn(rk808->dev, "%s no pdata, create it\n", __func__); 346 dev_warn(&client->dev, "%s no pdata, create it\n", __func__);
353 pdata = devm_kzalloc(rk808->dev, sizeof(*pdata), GFP_KERNEL); 347 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
354 if (!pdata) 348 if (!pdata)
355 return -ENOMEM; 349 return -ENOMEM;
356 } 350 }
@@ -371,11 +365,11 @@ static int rk808_regulator_probe(struct platform_device *pdev)
371 if (!reg_data) 365 if (!reg_data)
372 continue; 366 continue;
373 367
374 config.dev = rk808->dev; 368 config.dev = &client->dev;
375 config.driver_data = rk808; 369 config.driver_data = rk808;
376 config.regmap = rk808->regmap; 370 config.regmap = rk808->regmap;
377 371
378 if (rk808->dev->of_node) 372 if (client->dev.of_node)
379 config.of_node = pdata->of_node[i]; 373 config.of_node = pdata->of_node[i];
380 374
381 reg_data->supply_regulator = rk808_reg[i].name; 375 reg_data->supply_regulator = rk808_reg[i].name;
@@ -384,7 +378,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
384 rk808_rdev = devm_regulator_register(&pdev->dev, 378 rk808_rdev = devm_regulator_register(&pdev->dev,
385 &rk808_reg[i], &config); 379 &rk808_reg[i], &config);
386 if (IS_ERR(rk808_rdev)) { 380 if (IS_ERR(rk808_rdev)) {
387 dev_err(rk808->dev, 381 dev_err(&client->dev,
388 "failed to register %d regulator\n", i); 382 "failed to register %d regulator\n", i);
389 return PTR_ERR(rk808_rdev); 383 return PTR_ERR(rk808_rdev);
390 } 384 }