power_supply_sysfs: Handle -ENODATA in a special way
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Wed, 2 Dec 2009 21:24:51 +0000 (00:24 +0300)
committerAnton Vorontsov <avorontsov@ru.mvista.com>
Wed, 2 Dec 2009 21:38:06 +0000 (00:38 +0300)
There are cases when some device can not report any meaningful value,
e.g. TWL4030 charger can report voltage only when charging is
active.

In these cases drivers will return -ENODATA, and we shouldn't flood
kernel log with error messages.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
drivers/power/power_supply_sysfs.c

index 08144393d64b72e7b2a54d44929a6d47cbf18036..c790e0c77d4be02c71917fcdea8a2f91d2c9c33e 100644 (file)
@@ -65,7 +65,10 @@ static ssize_t power_supply_show_property(struct device *dev,
        ret = psy->get_property(psy, off, &value);
 
        if (ret < 0) {
-               if (ret != -ENODEV)
+               if (ret == -ENODATA)
+                       dev_dbg(dev, "driver has no data for `%s' property\n",
+                               attr->attr.name);
+               else if (ret != -ENODEV)
                        dev_err(dev, "driver failed to report `%s' property\n",
                                attr->attr.name);
                return ret;