Skip to content

Commit daa67bd

Browse files
lkundrakgregkh
authored andcommitted
power: supply: olpc_battery: correct the temperature units
commit ed54ffb upstream. According to [1] and [2], the temperature values are in tenths of degree Celsius. Exposing the Celsius value makes the battery appear on fire: $ upower -i /org/freedesktop/UPower/devices/battery_olpc_battery ... temperature: 236.9 degrees C Tested on OLPC XO-1 and OLPC XO-1.75 laptops. [1] include/linux/power_supply.h [2] Documentation/power/power_supply_class.txt Fixes: fb97287 ("[BATTERY] One Laptop Per Child power/battery driver") Cc: stable@vger.kernel.org Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f65b4d4 commit daa67bd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/power/supply/olpc_battery.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,14 @@ static int olpc_bat_get_property(struct power_supply *psy,
428428
if (ret)
429429
return ret;
430430

431-
val->intval = (s16)be16_to_cpu(ec_word) * 100 / 256;
431+
val->intval = (s16)be16_to_cpu(ec_word) * 10 / 256;
432432
break;
433433
case POWER_SUPPLY_PROP_TEMP_AMBIENT:
434434
ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2);
435435
if (ret)
436436
return ret;
437437

438-
val->intval = (int)be16_to_cpu(ec_word) * 100 / 256;
438+
val->intval = (int)be16_to_cpu(ec_word) * 10 / 256;
439439
break;
440440
case POWER_SUPPLY_PROP_CHARGE_COUNTER:
441441
ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2);

0 commit comments

Comments
 (0)