Skip to content

Commit

Permalink
Newly inserted battery might differ from one just removed, so
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Starikovskiy authored and Len Brown committed Dec 23, 2008
1 parent 3d44cc3 commit 50b1785
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 50b1785

Please sign in to comment.