lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1348589574-25655-36-git-send-email-mathieu.poirier@linaro.org>
Date:	Tue, 25 Sep 2012 10:12:32 -0600
From:	mathieu.poirier@...aro.org
To:	linux-kernel@...r.kernel.org, cbou@...l.ru, dwmw2@...radead.org
Cc:	mathieu.poirier@...aro.org
Subject: [PATCH 35/57] power: ab8500_fg: Report unscaled capacity

From: Martin Bergstrom <martin.bergstrom@...ricsson.com>

Unscaled capacity should be reported for POWER_SUPPLY_PROP_CAPACITY.

Signed-off-by: Martin Bergstrom <martin.bergstrom@...ricsson.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@...aro.org>
Reviewed-by: Marcus COOPER <marcus.xm.cooper@...ricsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@...ricsson.com>
---
 drivers/power/ab8500_fg.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index fde189a..c5732e7 100644
--- a/drivers/power/ab8500_fg.c
+++ b/drivers/power/ab8500_fg.c
@@ -2159,9 +2159,7 @@ static int ab8500_fg_get_property(struct power_supply *psy,
 			val->intval = di->bat_cap.prev_mah;
 		break;
 	case POWER_SUPPLY_PROP_CAPACITY:
-		if (di->bat->capacity_scaling)
-			val->intval = di->bat_cap.cap_scale.scaled_cap;
-		else if (di->flags.batt_unknown && !di->bat->chg_unknown_bat &&
+		if (di->flags.batt_unknown && !di->bat->chg_unknown_bat &&
 				di->flags.batt_id_received)
 			val->intval = 100;
 		else
@@ -2625,7 +2623,7 @@ static ssize_t ab8500_show_capacity(struct device *dev,
 	if (di->bat->capacity_scaling)
 		capacity = di->bat_cap.cap_scale.scaled_cap;
 	else
-		capacity = DIV_ROUND_CLOSEST(di->bat_cap.permille, 10);
+		capacity = di->bat_cap.prev_percent;
 
 	return scnprintf(buf, PAGE_SIZE, "%d\n", capacity);
 }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ