Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119709
b: refs/heads/master
c: aaad077
h: refs/heads/master
i:
  119707: 797bf83
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Dec 5, 2008
1 parent f93611d commit 992f87e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4857339d7c01cd81ce8872da2d1f9183b07b1c87
refs/heads/master: aaad077638be1a25871bcae5e43952d6b63abfca
17 changes: 10 additions & 7 deletions trunk/drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 992f87e

Please sign in to comment.