power: android_battery: fix negative temperature display
authorTodd Poynor <toddpoynor@google.com>
Mon, 6 Aug 2012 19:01:51 +0000 (12:01 -0700)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 20:40:55 +0000 (13:40 -0700)
Change-Id: Ic9798bc5194b6192fec726a8f136867f111e4765
Signed-off-by: Todd Poynor <toddpoynor@google.com>
drivers/power/android_battery.c

index 85f85f9e4ed8e768416375f122e2a8def6b03967..80c0bd228aa21b470372368be689a773358d4e47 100644 (file)
@@ -330,11 +330,11 @@ static void android_bat_monitor_work(struct work_struct *work)
                break;
        }
 
-       pr_info("battery: l=%d v=%d c=%d temp=%d.%d h=%d st=%d type=%s\n",
+       pr_info("battery: l=%d v=%d c=%d temp=%s%ld.%ld h=%d st=%d type=%s\n",
                battery->batt_soc, battery->batt_vcell/1000,
-               battery->batt_current, battery->batt_temp / 10,
-               battery->batt_temp % 10, battery->batt_health,
-               battery->charging_status,
+               battery->batt_current, battery->batt_temp < 0 ? "-" : "",
+               abs(battery->batt_temp / 10), abs(battery->batt_temp % 10),
+               battery->batt_health, battery->charging_status,
                charge_source_str(battery->charge_source));
        power_supply_changed(&battery->psy_bat);
        battery->last_poll = ktime_get_boottime();