All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi/battery: capacity_now should be assigned after comparing it to design_capacity.
@ 2014-08-09  9:43 Mariusz Ceier
  0 siblings, 0 replies; only message in thread
From: Mariusz Ceier @ 2014-08-09  9:43 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, linux-kernel, Mariusz Ceier

From: Mariusz Ceier <mceier+kernel@gmail.com>

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)."

Signed-off-by: Mariusz Ceier <mceier+kernel@gmail.com>
---
 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 48bcf38..1c162e7 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.0.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-08-09  9:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-09  9:43 [PATCH] acpi/battery: capacity_now should be assigned after comparing it to design_capacity Mariusz Ceier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.