ACPI: Fix ACPI battery regression introduced by commit 558073

Commit 558073dd56707864f09d563b64e7c37c021e89d2 ("ACPI: battery: Convert
discharge energy rate to current properly") caused the battery subsystem
to report wrong values of the remaining time on battery power and the
time until fully charged on Toshiba Portege R500 (and presumably on
other boxes too).

Fix the issue by correcting the conversion from mW to mA.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Rafael J. Wysocki and committed by Linus Torvalds aaad0776 4857339d

+10 -7
+10 -7
drivers/acpi/battery.c
··· 173 val->intval = battery->voltage_now * 1000; 174 break; 175 case POWER_SUPPLY_PROP_CURRENT_NOW: 176 - val->intval = battery->current_now * 1000; 177 - /* if power units are mW, convert to mA by 178 - dividing by current voltage (mV/1000) */ 179 - if (!battery->power_unit) { 180 - if (battery->voltage_now) { 181 val->intval /= battery->voltage_now; 182 - val->intval *= 1000; 183 - } else 184 val->intval = -1; 185 } 186 break;
··· 173 val->intval = battery->voltage_now * 1000; 174 break; 175 case POWER_SUPPLY_PROP_CURRENT_NOW: 176 + val->intval = battery->current_now; 177 + if (battery->power_unit) { 178 + val->intval *= 1000; 179 + } else { 180 + /* 181 + * If power units are mW, convert to mA by dividing by 182 + * current voltage. 183 + */ 184 + if (battery->voltage_now) 185 val->intval /= battery->voltage_now; 186 + else 187 val->intval = -1; 188 } 189 break;