Skip to contentSkip to conversation

regulator: core: Report microvolts in sysfs even with only list_voltage()

PATCH New Mark Brown 1 participant 1 message Aug 27, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 regulator: core: Report microvolts in sysfs even with only list_voltage()

If a regulator only supports a single voltage list_voltage() can be used to report what that voltage is so add this as one of the criteria for creating the microvolts file in sysfs.

---
 drivers/regulator/core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regulator/core.c +2 -1
index 06186ba..db7d59a 100644
@@ -3020,7 +3020,8 @@ static int add_regulator_attributes(struct regulator_dev *rdev)
 
 	/* some attributes need specific methods to be displayed */
 	if ((ops->get_voltage && ops->get_voltage(rdev) >= 0) ||
-	    (ops->get_voltage_sel && ops->get_voltage_sel(rdev) >= 0)) {
+	    (ops->get_voltage_sel && ops->get_voltage_sel(rdev) >= 0) ||
+	    (ops->list_voltage && ops->list_voltage(rdev, 0) >= 0)) {
 		status = device_create_file(dev, &dev_attr_microvolts);
 		if (status < 0)
 			return status;
Signature · 1 line
1.7.10.4