regulator: core: Report microvolts in sysfs even with only list_voltage()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 27 Aug 2012 18:37:04 +0000 (11:37 -0700)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 7 Sep 2012 01:48:15 +0000 (09:48 +0800)
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.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/core.c

index 2a3e4213865bb69053ac2658de9a7c445ef679ca..50977a69f09a26a1c06a946a78bc0c23bd320dbf 100644 (file)
@@ -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;