From: Mark Brown Date: Wed, 2 Nov 2011 11:39:09 +0000 (+0000) Subject: regulator: Don't create voltage sysfs entries if we can't read voltage X-Git-Tag: next-20111125~29^2~3 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4c78899b92335af0da11e104698e329bb50810b5;p=karo-tx-linux.git regulator: Don't create voltage sysfs entries if we can't read voltage Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 669d02160221..679f92ec9a45 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;