aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorMariusz Ceier <mceier+kernel@gmail.com>2014-08-09 05:43:31 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-08-10 10:19:31 -0400
commitd719870b41e00baf64d028c2668ae1fc3eb50e79 (patch)
tree6f49962a2622fbdd72c25c0782011d43570d3856 /drivers/acpi
parent3a54a57dceed78f7f3c35991d6d4a064a0c2e343 (diff)
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 <mceier+kernel@gmail.com> Cc: 3.16+ <stable@vger.kernel.org> # 3.16+ [rjw: Subject] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/battery.c2
1 files changed, 1 insertions, 1 deletions
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)
540 */ 540 */
541 if (battery->capacity_now > battery->full_charge_capacity 541 if (battery->capacity_now > battery->full_charge_capacity
542 && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { 542 && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) {
543 battery->capacity_now = battery->full_charge_capacity;
544 if (battery->capacity_now != battery->design_capacity) 543 if (battery->capacity_now != battery->design_capacity)
545 printk_once(KERN_WARNING FW_BUG 544 printk_once(KERN_WARNING FW_BUG
546 "battery: reported current charge level (%d) " 545 "battery: reported current charge level (%d) "
547 "is higher than reported maximum charge level (%d).\n", 546 "is higher than reported maximum charge level (%d).\n",
548 battery->capacity_now, battery->full_charge_capacity); 547 battery->capacity_now, battery->full_charge_capacity);
548 battery->capacity_now = battery->full_charge_capacity;
549 } 549 }
550 550
551 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) 551 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)