From d719870b41e00baf64d028c2668ae1fc3eb50e79 Mon Sep 17 00:00:00 2001 From: Mariusz Ceier Date: Sat, 9 Aug 2014 11:43:31 +0200 Subject: [PATCH] ACPI / battery: Fix warning message in acpi_battery_get_state() capacity_now should be assigned after comparing it to design_capacity. Otherwise warning is printed even when capacity_now before assignment is equal to design_capacity, making the check useless and "current charge level" wrong (it should be higher than, not equal to, "maximum charge level", which is full_charge_capacity): "battery: reported current charge level (56410) is higher than reported maximum charge level (56410)." Fixes: 232de5143790 (ACPI / battery: fix wrong value of capacity_now reported when fully charged) Signed-off-by: Mariusz Ceier Cc: 3.16+ # 3.16+ [rjw: Subject] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 48bcf38a0ea8..1c162e7be045 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -540,12 +540,12 @@ static int acpi_battery_get_state(struct acpi_battery *battery) */ if (battery->capacity_now > battery->full_charge_capacity && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { - battery->capacity_now = battery->full_charge_capacity; if (battery->capacity_now != battery->design_capacity) printk_once(KERN_WARNING FW_BUG "battery: reported current charge level (%d) " "is higher than reported maximum charge level (%d).\n", battery->capacity_now, battery->full_charge_capacity); + battery->capacity_now = battery->full_charge_capacity; } if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) -- 2.34.1