aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2015-05-15 10:27:40 -0400
committerLee Jones <lee.jones@linaro.org>2015-05-27 08:34:15 -0400
commite0c21530fa91f119bfca19640a67380c6b14f12a (patch)
treed1579ae40cb4589126d6e8cc91486137bef5ec8f
parent5ebe6afaf0057ac3eaeb98defd5456894b446d22 (diff)
mfd: da9052: Fix broken regulator probe
Fix broken probe of da9052 regulators, which since commit b3f6c73db732 ("mfd: da9052-core: Fix platform-device id collision") use a non-deterministic platform-device id to retrieve static regulator information. Fortunately, adequate error handling was in place so probe would simply fail with an error message. Update the mfd-cell ids to be zero-based and use those to identify the cells when probing the regulator devices. Fixes: b3f6c73db732 ("mfd: da9052-core: Fix platform-device id collision") Cc: stable <stable@vger.kernel.org> # v3.19 Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/da9052-core.c8
-rw-r--r--drivers/regulator/da9052-regulator.c5
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index ae498b53ee40..46e3840c7a37 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -433,6 +433,10 @@ EXPORT_SYMBOL_GPL(da9052_adc_read_temp);
433static const struct mfd_cell da9052_subdev_info[] = { 433static const struct mfd_cell da9052_subdev_info[] = {
434 { 434 {
435 .name = "da9052-regulator", 435 .name = "da9052-regulator",
436 .id = 0,
437 },
438 {
439 .name = "da9052-regulator",
436 .id = 1, 440 .id = 1,
437 }, 441 },
438 { 442 {
@@ -484,10 +488,6 @@ static const struct mfd_cell da9052_subdev_info[] = {
484 .id = 13, 488 .id = 13,
485 }, 489 },
486 { 490 {
487 .name = "da9052-regulator",
488 .id = 14,
489 },
490 {
491 .name = "da9052-onkey", 491 .name = "da9052-onkey",
492 }, 492 },
493 { 493 {
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
index 8a4df7a1f2ee..e628d4c2f2ae 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -394,6 +394,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id,
394 394
395static int da9052_regulator_probe(struct platform_device *pdev) 395static int da9052_regulator_probe(struct platform_device *pdev)
396{ 396{
397 const struct mfd_cell *cell = mfd_get_cell(pdev);
397 struct regulator_config config = { }; 398 struct regulator_config config = { };
398 struct da9052_regulator *regulator; 399 struct da9052_regulator *regulator;
399 struct da9052 *da9052; 400 struct da9052 *da9052;
@@ -409,7 +410,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
409 regulator->da9052 = da9052; 410 regulator->da9052 = da9052;
410 411
411 regulator->info = find_regulator_info(regulator->da9052->chip_id, 412 regulator->info = find_regulator_info(regulator->da9052->chip_id,
412 pdev->id); 413 cell->id);
413 if (regulator->info == NULL) { 414 if (regulator->info == NULL) {
414 dev_err(&pdev->dev, "invalid regulator ID specified\n"); 415 dev_err(&pdev->dev, "invalid regulator ID specified\n");
415 return -EINVAL; 416 return -EINVAL;
@@ -419,7 +420,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
419 config.driver_data = regulator; 420 config.driver_data = regulator;
420 config.regmap = da9052->regmap; 421 config.regmap = da9052->regmap;
421 if (pdata && pdata->regulators) { 422 if (pdata && pdata->regulators) {
422 config.init_data = pdata->regulators[pdev->id]; 423 config.init_data = pdata->regulators[cell->id];
423 } else { 424 } else {
424#ifdef CONFIG_OF 425#ifdef CONFIG_OF
425 struct device_node *nproot = da9052->dev->of_node; 426 struct device_node *nproot = da9052->dev->of_node;