summaryrefslogtreecommitdiff
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2008-12-22 23:44:54 (GMT)
committerLen Brown <len.brown@intel.com>2008-12-23 00:32:55 (GMT)
commit50b178512b7d6e7724f87459f6bd06504c9c2da1 (patch)
tree0de7ef5345a3d1ae20b8f6082dc55d5ef2291f69 /drivers/acpi/battery.c
parent3d44cc3e01ee1b40317f79ed54324e25c4f848df (diff)
downloadlinux-50b178512b7d6e7724f87459f6bd06504c9c2da1.tar.xz
Newly inserted battery might differ from one just removed, so
update of battery info fields is required. Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Acked-by: Andy Neitzke <neitzke@ias.edu> Signed-off-by: Alexey Starikovskiy <astarikovskiy <at> suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/battery.c')
-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 1423b0c..65132f9 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -471,7 +471,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;
@@ -482,7 +482,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;