Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johan Hovold and committed by
Lee Jones
e0c21530 5ebe6afa

+7 -6
+4 -4
drivers/mfd/da9052-core.c
··· 433 433 static const struct mfd_cell da9052_subdev_info[] = { 434 434 { 435 435 .name = "da9052-regulator", 436 + .id = 0, 437 + }, 438 + { 439 + .name = "da9052-regulator", 436 440 .id = 1, 437 441 }, 438 442 { ··· 486 482 { 487 483 .name = "da9052-regulator", 488 484 .id = 13, 489 - }, 490 - { 491 - .name = "da9052-regulator", 492 - .id = 14, 493 485 }, 494 486 { 495 487 .name = "da9052-onkey",
+3 -2
drivers/regulator/da9052-regulator.c
··· 394 394 395 395 static int da9052_regulator_probe(struct platform_device *pdev) 396 396 { 397 + const struct mfd_cell *cell = mfd_get_cell(pdev); 397 398 struct regulator_config config = { }; 398 399 struct da9052_regulator *regulator; 399 400 struct da9052 *da9052; ··· 410 409 regulator->da9052 = da9052; 411 410 412 411 regulator->info = find_regulator_info(regulator->da9052->chip_id, 413 - pdev->id); 412 + cell->id); 414 413 if (regulator->info == NULL) { 415 414 dev_err(&pdev->dev, "invalid regulator ID specified\n"); 416 415 return -EINVAL; ··· 420 419 config.driver_data = regulator; 421 420 config.regmap = da9052->regmap; 422 421 if (pdata && pdata->regulators) { 423 - config.init_data = pdata->regulators[pdev->id]; 422 + config.init_data = pdata->regulators[cell->id]; 424 423 } else { 425 424 #ifdef CONFIG_OF 426 425 struct device_node *nproot = da9052->dev->of_node;