aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2008-12-23 02:44:54 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2009-02-06 14:00:44 -0800
commit04fa5274d09f88417bce73c9364018a876227505 (patch)
tree9a83823cddcd2981f00ac93ddce6c35844129d77 /drivers
parent0a3e5c9d9093df1358ae3e6a5c151d172d2a871e (diff)
Newly inserted battery might differ from one just removed, so update of battery info fields is required.
commit 50b178512b7d6e7724f87459f6bd06504c9c2da1 upstream. Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Acked-by: Andy Neitzke <neitzke@ias.edu> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com> Cc: Thomas Renninger <trenn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/battery.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index b1c723f9f58..e5ca3a0bb43 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -472,7 +472,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
static int acpi_battery_update(struct acpi_battery *battery)
{
- int result;
+ int result, old_present = acpi_battery_present(battery);
result = acpi_battery_get_status(battery);
if (result)
return result;
@@ -483,7 +483,8 @@ static int acpi_battery_update(struct acpi_battery *battery)
return 0;
}
#endif
- if (!battery->update_time) {
+ if (!battery->update_time ||
+ old_present != acpi_battery_present(battery)) {
result = acpi_battery_get_info(battery);
if (result)
return result;