public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] ACPI battery: update battery status first when querying from sysfs
@ 2010-11-02  3:24 Zhang Rui
  2010-11-02  4:13 ` Seblu
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2010-11-02  3:24 UTC (permalink / raw)
  To: Brown, Len; +Cc: linux-acpi@vger.kernel.org, cbou, seblu, Zhang, Rui


Sometimes the Battery driver doesn't get notifications when it's
plugged/unplugged. And this results in the incorrect Battery
status reported by the power supply sysfs I/F.

Update the Battery status first when querying from sysfs.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/battery.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/drivers/acpi/battery.c
===================================================================
--- linux-2.6.orig/drivers/acpi/battery.c
+++ linux-2.6/drivers/acpi/battery.c
@@ -184,6 +184,9 @@ static int acpi_battery_get_property(str
 	int ret = 0;
 	struct acpi_battery *battery = to_acpi_battery(psy);
 
+	if (acpi_battery_update(battery))
+		return -ENODEV;
+
 	if (acpi_battery_present(battery)) {
 		/* run battery update only if it is present */
 		acpi_battery_get_state(battery);



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-02 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-02  3:24 [PATCH 2/2] ACPI battery: update battery status first when querying from sysfs Zhang Rui
2010-11-02  4:13 ` Seblu
2010-11-02  5:22   ` Zhang Rui
2010-11-02 18:22     ` Seblu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox