All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] ACPI: update battery status first when querying from sysfs
@ 2010-12-08  2:40 Zhang Rui
  2010-12-09 20:35 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Rui @ 2010-12-08  2:40 UTC (permalink / raw)
  To: Brown, Len; +Cc: linux-acpi, 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 Battery status first when querying from sysfs.
http://marc.info/?l=linux-acpi&m=128855015826728&w=2

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

Index: linux-2.6/drivers/acpi/battery.c
===================================================================
--- linux-2.6.orig/drivers/acpi/battery.c
+++ linux-2.6/drivers/acpi/battery.c
@@ -130,6 +130,8 @@ struct acpi_battery {
 	unsigned long flags;
 };
 
+static int acpi_battery_update(struct acpi_battery *battery);
+
 #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
 
 inline int acpi_battery_present(struct acpi_battery *battery)
@@ -184,6 +186,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] 2+ messages in thread

* Re: [PATCH 4/4] ACPI: update battery status first when querying from sysfs
  2010-12-08  2:40 [PATCH 4/4] ACPI: update battery status first when querying from sysfs Zhang Rui
@ 2010-12-09 20:35 ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2010-12-09 20:35 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, seblu

applied

thanks,
Len Brown, Intel Open Source Technology Center


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

end of thread, other threads:[~2010-12-09 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-08  2:40 [PATCH 4/4] ACPI: update battery status first when querying from sysfs Zhang Rui
2010-12-09 20:35 ` Len Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.