aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index a0a178dd189..4fb3c12ac1d 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -173,14 +173,17 @@ static int acpi_battery_get_property(struct power_supply *psy,
val->intval = battery->voltage_now * 1000;
break;
case POWER_SUPPLY_PROP_CURRENT_NOW:
- val->intval = battery->current_now * 1000;
- /* if power units are mW, convert to mA by
- dividing by current voltage (mV/1000) */
- if (!battery->power_unit) {
- if (battery->voltage_now) {
+ val->intval = battery->current_now;
+ if (battery->power_unit) {
+ val->intval *= 1000;
+ } else {
+ /*
+ * If power units are mW, convert to mA by dividing by
+ * current voltage.
+ */
+ if (battery->voltage_now)
val->intval /= battery->voltage_now;
- val->intval *= 1000;
- } else
+ else
val->intval = -1;
}
break;