Skip to content

Commit

Permalink
power_supply_sysfs: Handle -ENODATA in a special way
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Anton Vorontsov committed Dec 2, 2009
1 parent 0e19dbb commit 9d233e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/power/power_supply_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9d233e8

Please sign in to comment.