summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-02 11:39:09 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-23 14:03:42 +0000
commit4c78899b92335af0da11e104698e329bb50810b5 (patch)
tree377f59b67fabaf229072f74daf8e3350cf2b5175 /drivers/regulator
parentaebe495895f5542213dd17a644647b0aae8353f0 (diff)
downloadop-kernel-dev-4c78899b92335af0da11e104698e329bb50810b5.zip
op-kernel-dev-4c78899b92335af0da11e104698e329bb50810b5.tar.gz
regulator: Don't create voltage sysfs entries if we can't read voltage
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 669d021..679f92e 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2503,7 +2503,8 @@ static int add_regulator_attributes(struct regulator_dev *rdev)
int status = 0;
/* some attributes need specific methods to be displayed */
- if (ops->get_voltage || ops->get_voltage_sel) {
+ if ((ops->get_voltage && ops->get_voltage(rdev) >= 0) ||
+ (ops->get_voltage_sel && ops->get_voltage_sel(rdev) >= 0)) {
status = device_create_file(dev, &dev_attr_microvolts);
if (status < 0)
return status;
OpenPOWER on IntegriCloud