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: <20130209015718.GA13561@lizard.sbx05663.mountca.wayport.net>
Date:	Fri, 8 Feb 2013 17:57:18 -0800
From:	Anton Vorontsov <anton@...msg.org>
To:	Pali Rohár <pali.rohar@...il.com>
Cc:	David Woodhouse <dwmw2@...radead.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bq27x00_battery: Fix reporting battery temperature

On Wed, Feb 06, 2013 at 06:56:34PM +0100, Pali Rohár wrote:
[...]
> >  * All voltages, currents, charges, energies, time and
> > temperatures in uV, * µA, µAh, µWh, seconds and tenths of
> > degree Celsius unless otherwise * stated. It's driver's job
[...]
> bq27x00_battery reporting "POWER_SUPPLY_TEMP=2700"
> and rx51_battery reporting "POWER_SUPPLY_TEMP=3590"
[...]
> Subject: [PATCH] bq27x00_battery: Report temperature in 1/100 degree Celsius

Hm. The documentation says tenth (1/10) degrees, and you even restate it
in the commit message. But the subject, and your example seem to prove
that you still report it in 1/100 of Celsius.

Unless your phone was on fire during the time you took the values, I tend
to think the patch needs to be fixed. :-)

Thanks,
Anton

> * Documentation/power/power_supply_class.txt say that temperature must be reported in tenths of degree 
> Celsius
> 
> Signed-off-by: Pali Rohár <pali.rohar@...il.com>
> ---
>  drivers/power/bq27x00_battery.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
> index 5b077af..482755f 100644
> --- a/drivers/power/bq27x00_battery.c
> +++ b/drivers/power/bq27x00_battery.c
> @@ -312,8 +312,10 @@ static int bq27x00_battery_read_temperature(struct bq27x00_device_info *di)
>  		return temp;
>  	}
>  
> -	if (!bq27xxx_is_chip_version_higher(di))
> -		temp = 5 * temp / 2;
> +	if (bq27xxx_is_chip_version_higher(di))
> +		temp *= 10;
> +	else
> +		temp *= 25;
>  
>  	return temp;
>  }
> @@ -640,7 +642,7 @@ static int bq27x00_battery_get_property(struct power_supply *psy,
>  	case POWER_SUPPLY_PROP_TEMP:
>  		ret = bq27x00_simple_value(di->cache.temperature, val);
>  		if (ret == 0)
> -			val->intval -= 2731;
> +			val->intval -= 27310;
>  		break;
>  	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
>  		ret = bq27x00_simple_value(di->cache.time_to_empty, val);
> -- 
> 1.7.10.4
> 
> -- 
> Pali Rohár
> pali.rohar@...il.com
--
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