linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] regulator: core: Add checking n_voltages if using list_voltage() to read voltage regulators
@ 2012-08-10  1:32 Axel Lin
  2012-08-10  1:33 ` [PATCH 2/6] regulator: ab3100: Remove get_voltage implementation for regulator_ops_fixed Axel Lin
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Axel Lin @ 2012-08-10  1:32 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel

Use list_voltage() to read single voltage regulators should be only applied to
single voltage regulators, thus add checking n_voltages for this case.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0fffeae..5469f9f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2395,7 +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) {
+	} else if (rdev->desc->ops->list_voltage &&
+		   (rdev->desc->n_voltages == 1)) {
 		ret = rdev->desc->ops->list_voltage(rdev, 0);
 	} else {
 		return -EINVAL;
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-08-13 12:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-10  1:32 [PATCH 1/6] regulator: core: Add checking n_voltages if using list_voltage() to read voltage regulators Axel Lin
2012-08-10  1:33 ` [PATCH 2/6] regulator: ab3100: Remove get_voltage implementation for regulator_ops_fixed Axel Lin
2012-08-13 12:31   ` Mark Brown
2012-08-10  1:34 ` [PATCH 3/6] regulator: ab8500: Remove get_voltage implementation for ab8500_regulator_fixed_ops Axel Lin
2012-08-10  1:35 ` [PATCH 4/6] regulator: isl6271a: Remove get_voltage implementation for isl_fixed_ops Axel Lin
2012-08-10  1:37 ` [PATCH 5/6] regulator: twl: Remove get_voltage implementation for single voltage regulators Axel Lin
2012-08-10  1:38 ` [PATCH 6/6] regulator: mc13xxx: " Axel Lin
2012-08-10 10:05 ` [PATCH 1/6] regulator: core: Add checking n_voltages if using list_voltage() to read " Mark Brown
2012-08-10 12:27   ` Axel Lin
2012-08-10 12:29     ` Mark Brown
2012-08-11  2:22       ` Axel Lin
2012-08-13 12:30         ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).