regulator: core: Use dev_get_regmap() to find the regmap
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 8 May 2012 17:10:45 +0000 (18:10 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 3 Jun 2012 12:20:34 +0000 (13:20 +0100)
If no regmap is explicitly specified then use dev_get_regmap() to obtain
one. The driver must explicitly enable any actual usage of the regmap
so there's no concern with unwanted usage.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
drivers/regulator/core.c

index 7965e86a3fbbc09b64a8558a6a1aa44a0f6b09ae..8521e0d6b3bc0f17a1c12da1cce2dfbc2968d56b 100644 (file)
@@ -3128,7 +3128,10 @@ regulator_register(const struct regulator_desc *regulator_desc,
        rdev->reg_data = config->driver_data;
        rdev->owner = regulator_desc->owner;
        rdev->desc = regulator_desc;
-       rdev->regmap = config->regmap;
+       if (config->regmap)
+               rdev->regmap = config->regmap;
+       else
+               rdev->regmap = dev_get_regmap(dev, NULL);
        INIT_LIST_HEAD(&rdev->consumer_list);
        INIT_LIST_HEAD(&rdev->list);
        BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);