Commit 255f0385 authored by Len Brown's avatar Len Brown

Pull bugzilla-7897 into release branch

parents 902b236c e6d0f562
...@@ -1033,21 +1033,19 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) ...@@ -1033,21 +1033,19 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
} else { } else {
seq_printf(seq, "capacity state: ok\n"); seq_printf(seq, "capacity state: ok\n");
} }
foo = (s16) battery->state.amperage * battery->info.ipscale;
if (battery->info.capacity_mode) {
foo = foo * battery->info.design_voltage / 1000;
}
if (battery->state.amperage < 0) { if (battery->state.amperage < 0) {
seq_printf(seq, "charging state: discharging\n"); seq_printf(seq, "charging state: discharging\n");
foo = battery->state.remaining_capacity * cscale * 60 / seq_printf(seq, "present rate: %d %s\n",
(battery->state.average_time_to_empty == 0 ? 1 : -foo, battery->info.capacity_mode ? "mW" : "mA");
battery->state.average_time_to_empty);
seq_printf(seq, "present rate: %i%s\n",
foo, battery->info.capacity_mode ? "0 mW" : " mA");
} else if (battery->state.amperage > 0) { } else if (battery->state.amperage > 0) {
seq_printf(seq, "charging state: charging\n"); seq_printf(seq, "charging state: charging\n");
foo = (battery->info.full_charge_capacity - seq_printf(seq, "present rate: %d %s\n",
battery->state.remaining_capacity) * cscale * 60 / foo, battery->info.capacity_mode ? "mW" : "mA");
(battery->state.average_time_to_full == 0 ? 1 :
battery->state.average_time_to_full);
seq_printf(seq, "present rate: %i%s\n",
foo, battery->info.capacity_mode ? "0 mW" : " mA");
} else { } else {
seq_printf(seq, "charging state: charged\n"); seq_printf(seq, "charging state: charged\n");
seq_printf(seq, "present rate: 0 %s\n", seq_printf(seq, "present rate: 0 %s\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment