lkml.org 
[lkml]   [2012]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 1/6] regulator: core: Add checking n_voltages if using list_voltage() to read voltage regulators
From
Date
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




\
 
 \ /
  Last update: 2012-08-10 04:21    [from the cache]
©2003-2011 Jasper Spaans