[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201010231931.24701.rjw@sisk.pl>
Date: Sat, 23 Oct 2010 19:31:24 +0200
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Sitsofe Wheeler <sitsofe@...oo.com>
Cc: Henrique de Moraes Holschuh <hmh@....eng.br>,
Matthew Garrett <mjg59@...f.ucam.org>,
Len Brown <lenb@...nel.org>, Zhang Rui <rui.zhang@...el.com>,
David Zeuthen <davidz@...hat.com>,
Richard Hughes <richard@...hsie.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPI / Battery: Return -ENODATA for unknown values in get_property()
On Saturday, October 23, 2010, Sitsofe Wheeler wrote:
> On Sat, Oct 23, 2010 at 12:19:13AM +0200, Rafael J. Wysocki wrote:
> >
> > OK, so can you test the patch below, please?
>
> The latest patch seems to fix/workaround the problem. upower now reports
> 0 as the energy rate, there are no warnings in dmesg and battery hotplug
> works. Looks good and there's the option for a future upower to
> interpret the missing sysfs as meaning "unknown".
>
> Tested-by: Sitsofe Wheeler <sitsofe@...oo.com>
Thanks for testing!
> > The function acpi_battery_get_property() is called by the
> > power supply framework's function power_supply_show_property()
> > implementing the sysfs interface for power supply devices as the
> > ACPI battery driver's ->get_property() callback. Thus it is supposed
> > to return error code if the value of the given property is unknown.
> > Unfortunately, however, it returns 0 in those cases and puts a
> > wrong (negative) value into the intval field of the
> > union power_supply_propval object provided by
> > power_supply_show_property(). In consequence, wron negative
>
> wron -> wrong?
Sure, thanks.
> > Fix this by making acpi_battery_get_property() return -ENODEV
> > for properties with unknown values (-ENODEV is returned, because
> > power_supply_uevent() returns with error for any other error code
> > returned by power_supply_show_property()).
>
> OK that's sneaky and clever - technically power_supply_uevent should be
> more robust but presumably things are already prepared to handle -ENODEV
Yes, they are. That's why I decided to use it. :-)
> so overloading the meaning leads to the smallest change.
That's correct.
I'll repost the patch shortly with fixed changelog and your tested-by.
Thanks,
Rafael
--
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