summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-12-02 19:50:27 -0800
committerDavid S. Miller <davem@davemloft.net>2008-12-02 19:50:27 -0800
commitaa2ba5f1082dc705745899584aac8416d710c056 (patch)
treebde0bf4aff036c6bac19a0212194ae1092afb3c9 /drivers/acpi/battery.c
parent68024541e2e5a8f35e281daaa5068a29e2a538a5 (diff)
parentf6f7b52e2f6149d2ee365717afff315b05720162 (diff)
downloadop-kernel-dev-aa2ba5f1082dc705745899584aac8416d710c056.zip
op-kernel-dev-aa2ba5f1082dc705745899584aac8416d710c056.tar.gz
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/ixgbe/ixgbe_main.c drivers/net/smc91x.c
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 1423b0c..a0a178d 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -174,6 +174,15 @@ static int acpi_battery_get_property(struct power_supply *psy,
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->voltage_now;
+ val->intval *= 1000;
+ } else
+ val->intval = -1;
+ }
break;
case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
OpenPOWER on IntegriCloud