[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091202212710.GA24789@oksana.dev.rtsoft.ru>
Date: Thu, 3 Dec 2009 00:27:10 +0300
From: Anton Vorontsov <avorontsov@...mvista.com>
To: Grazvydas Ignotas <notasas@...il.com>
Cc: Madhusudhan <madhu.cr@...com>, linux-kernel@...r.kernel.org,
linux-omap@...r.kernel.org
Subject: Re: [PATCH] power_supply: Add driver for TWL4030/TPS65950 BCI
charger
On Wed, Dec 02, 2009 at 10:38:31PM +0200, Grazvydas Ignotas wrote:
> On Mon, Nov 30, 2009 at 8:58 PM, Anton Vorontsov
> <avorontsov@...mvista.com> wrote:
> > On Mon, Nov 30, 2009 at 12:45:20PM -0600, Madhusudhan wrote:
> > [...]
> >> > + case POWER_SUPPLY_PROP_VOLTAGE_NOW:
> >> > + /* charging must be active for meaningful result */
> >> > + if (!is_charging) {
> >>
> >> How about putting a kern_info here?
> >
> > It might be better to return -EINVAL.
>
> That causes lots of warnings from power_supply core (driver failed to
> report XXX property), Not sure what to do here, I'd prefer to keep
> returning 0.
Lying to userspace is a bad idea.
How about this patch + changing the driver to return -ENODATA?
>From 0fe4c834b551c4d4454d57acaf75645675d199ee Mon Sep 17 00:00:00 2001
From: Anton Vorontsov <avorontsov@...mvista.com>
Date: Thu, 3 Dec 2009 00:24:51 +0300
Subject: [PATCH] power_supply_sysfs: Handle -ENODATA in a special way
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@...mvista.com>
---
drivers/power/power_supply_sysfs.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 0814439..c790e0c 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -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;
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists