diff options
author | Vladimir Lebedev <vladimir.p.lebedev@intel.com> | 2007-02-10 01:51:13 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-10 01:51:13 -0500 |
commit | e6d0f5622d30a3b98fb0ba6264d5006a18270890 (patch) | |
tree | 0564c3cdc47ac8a6eb783df32f591ea7c2411da0 /drivers/acpi/sbs.c | |
parent | eaefd5fb7d793c9c1bcef1b0c0d5ec3824a85b91 (diff) |
ACPI: sbs: fix present rate
http://bugzilla.kernel.org/show_bug.cgi?id=7897
Signed-off-by: Vladimir Lebedev <vladimir.p.lebedev@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r-- | drivers/acpi/sbs.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index f58fc7447ab4..87b48f838164 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -1034,21 +1034,19 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
1034 | } else { | 1034 | } else { |
1035 | seq_printf(seq, "capacity state: ok\n"); | 1035 | seq_printf(seq, "capacity state: ok\n"); |
1036 | } | 1036 | } |
1037 | |||
1038 | foo = (s16) battery->state.amperage * battery->info.ipscale; | ||
1039 | if (battery->info.capacity_mode) { | ||
1040 | foo = foo * battery->info.design_voltage / 1000; | ||
1041 | } | ||
1037 | if (battery->state.amperage < 0) { | 1042 | if (battery->state.amperage < 0) { |
1038 | seq_printf(seq, "charging state: discharging\n"); | 1043 | seq_printf(seq, "charging state: discharging\n"); |
1039 | foo = battery->state.remaining_capacity * cscale * 60 / | 1044 | seq_printf(seq, "present rate: %d %s\n", |
1040 | (battery->state.average_time_to_empty == 0 ? 1 : | 1045 | -foo, battery->info.capacity_mode ? "mW" : "mA"); |
1041 | battery->state.average_time_to_empty); | ||
1042 | seq_printf(seq, "present rate: %i%s\n", | ||
1043 | foo, battery->info.capacity_mode ? "0 mW" : " mA"); | ||
1044 | } else if (battery->state.amperage > 0) { | 1046 | } else if (battery->state.amperage > 0) { |
1045 | seq_printf(seq, "charging state: charging\n"); | 1047 | seq_printf(seq, "charging state: charging\n"); |
1046 | foo = (battery->info.full_charge_capacity - | 1048 | seq_printf(seq, "present rate: %d %s\n", |
1047 | battery->state.remaining_capacity) * cscale * 60 / | 1049 | foo, battery->info.capacity_mode ? "mW" : "mA"); |
1048 | (battery->state.average_time_to_full == 0 ? 1 : | ||
1049 | battery->state.average_time_to_full); | ||
1050 | seq_printf(seq, "present rate: %i%s\n", | ||
1051 | foo, battery->info.capacity_mode ? "0 mW" : " mA"); | ||
1052 | } else { | 1050 | } else { |
1053 | seq_printf(seq, "charging state: charged\n"); | 1051 | seq_printf(seq, "charging state: charged\n"); |
1054 | seq_printf(seq, "present rate: 0 %s\n", | 1052 | seq_printf(seq, "present rate: 0 %s\n", |