Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52b84dac authored by AnilKumar Ch's avatar AnilKumar Ch Committed by Mark Brown
Browse files

regulator: core: Try using the parent device for the default regmap



If the device doesn't have a regmap specified by the driver and we can't
find one on the device itself try its parent, providing a useful defualt
for many MFDs.

[Rewrite commit message -- broonie]

Signed-off-by: default avatarAnilKumar Ch <anilkumar@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 2b5a24a0
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -3202,8 +3202,10 @@ regulator_register(const struct regulator_desc *regulator_desc,
	rdev->desc = regulator_desc;
	rdev->desc = regulator_desc;
	if (config->regmap)
	if (config->regmap)
		rdev->regmap = config->regmap;
		rdev->regmap = config->regmap;
	else
	else if (dev_get_regmap(dev, NULL))
		rdev->regmap = dev_get_regmap(dev, NULL);
		rdev->regmap = dev_get_regmap(dev, NULL);
	else if (dev->parent)
		rdev->regmap = dev_get_regmap(dev->parent, NULL);
	INIT_LIST_HEAD(&rdev->consumer_list);
	INIT_LIST_HEAD(&rdev->consumer_list);
	INIT_LIST_HEAD(&rdev->list);
	INIT_LIST_HEAD(&rdev->list);
	BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);
	BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);