From: Mark Brown Date: Thu, 9 Aug 2012 15:42:19 +0000 (+0100) Subject: regulator: core: Use list_voltage() to read single voltage regulators X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f7df20ec32;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git regulator: core: Use list_voltage() to read single voltage regulators If the regulator doesn't supply a way of reading back the voltage but does provide a list_voltage() operation then use that with a selector of zero to read the voltage. Regulators doing this means that we have the list operation there for consumers that want to configure themselves. Reported-by: Stephen Warren Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 157def15ed78..ff8f54447305 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2395,6 +2395,8 @@ static int _regulator_get_voltage(struct regulator_dev *rdev) ret = rdev->desc->ops->list_voltage(rdev, sel); } else if (rdev->desc->ops->get_voltage) { ret = rdev->desc->ops->get_voltage(rdev); + } else if (rdev->desc->ops->list_voltage) { + ret = rdev->desc->ops->list_voltage(rdev, 0); } else { return -EINVAL; }