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-next>] [day] [month] [year] [list]
Date:	Tue, 14 Dec 2010 17:01:25 -0800
From:	rklein <rklein@...dia.com>
To:	Anton Vorontsov <cbouatmailru@...il.com>
Cc:	Andrew Chew <AChew@...dia.com>, "olof@...om.net" <olof@...om.net>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/1] power: bq20z75: Update return value of CURRENT NOW

The BQ20Z75 will return a negative value for current if the battery is
discharging and a positive value if charging. This should always be
exported
as a positive number.

Signed-off-by: Rhyland Klein <rklein@...dia.com>
---
 drivers/power/bq20z75.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/power/bq20z75.c b/drivers/power/bq20z75.c
index 492da27..a039ea0 100644
--- a/drivers/power/bq20z75.c
+++ b/drivers/power/bq20z75.c
@@ -220,6 +220,10 @@ static int bq20z75_get_battery_property(struct
i2c_client *client,
        if (bq20z75_data[reg_offset].min_value < 0)
                ret = (s16)ret;

+       /* for current, it shoud be always positive */
+       if (psp == POWER_SUPPLY_PROP_CURRENT_NOW)
+               ret = abs(ret);
+
        if (ret >= bq20z75_data[reg_offset].min_value &&
            ret <= bq20z75_data[reg_offset].max_value) {
                val->intval = ret;

--
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