From 50b178512b7d6e7724f87459f6bd06504c9c2da1 Mon Sep 17 00:00:00 2001 From: Alexey Starikovskiy Date: Tue, 23 Dec 2008 02:44:54 +0300 Subject: [PATCH] Newly inserted battery might differ from one just removed, so update of battery info fields is required. Signed-off-by: Alexey Starikovskiy Acked-by: Andy Neitzke Signed-off-by: Alexey Starikovskiy suse.de> Signed-off-by: Len Brown --- drivers/acpi/battery.c | 5 +++-- 1 file 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; -- 2.7.4