diff options
author | AnilKumar Ch <anilkumar@ti.com> | 2012-09-07 11:15:05 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-07 20:54:15 -0400 |
commit | 52b84dac436a681fa51dad2b9e57b6ea50309cbd (patch) | |
tree | f7bfcf40abfde3305efbe4d02d4df6c3661ab759 | |
parent | 2b5a24a01df12fbfa3e702ad7efae27bcb852e33 (diff) |
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: AnilKumar Ch <anilkumar@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | drivers/regulator/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index ed376d9f525d..03fad8153476 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -3202,8 +3202,10 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
3202 | rdev->desc = regulator_desc; | 3202 | rdev->desc = regulator_desc; |
3203 | if (config->regmap) | 3203 | if (config->regmap) |
3204 | rdev->regmap = config->regmap; | 3204 | rdev->regmap = config->regmap; |
3205 | else | 3205 | else if (dev_get_regmap(dev, NULL)) |
3206 | rdev->regmap = dev_get_regmap(dev, NULL); | 3206 | rdev->regmap = dev_get_regmap(dev, NULL); |
3207 | else if (dev->parent) | ||
3208 | rdev->regmap = dev_get_regmap(dev->parent, NULL); | ||
3207 | INIT_LIST_HEAD(&rdev->consumer_list); | 3209 | INIT_LIST_HEAD(&rdev->consumer_list); |
3208 | INIT_LIST_HEAD(&rdev->list); | 3210 | INIT_LIST_HEAD(&rdev->list); |
3209 | BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier); | 3211 | BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier); |