aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/apm_power.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/power/apm_power.c b/drivers/power/apm_power.c
index 39a90a6f0f80..32ebfd76722a 100644
--- a/drivers/power/apm_power.c
+++ b/drivers/power/apm_power.c
@@ -200,19 +200,17 @@ static void apm_battery_apm_get_power_status(struct apm_power_info *info)
200 info->units = APM_UNITS_MINS; 200 info->units = APM_UNITS_MINS;
201 201
202 if (status.intval == POWER_SUPPLY_STATUS_CHARGING) { 202 if (status.intval == POWER_SUPPLY_STATUS_CHARGING) {
203 if (MPSY_PROP(TIME_TO_FULL_AVG, &time_to_full)) { 203 if (!MPSY_PROP(TIME_TO_FULL_AVG, &time_to_full) ||
204 if (MPSY_PROP(TIME_TO_FULL_NOW, &time_to_full)) 204 !MPSY_PROP(TIME_TO_FULL_NOW, &time_to_full))
205 info->time = calculate_time(status.intval); 205 info->time = time_to_full.intval / 60;
206 else 206 else
207 info->time = time_to_full.intval / 60; 207 info->time = calculate_time(status.intval);
208 }
209 } else { 208 } else {
210 if (MPSY_PROP(TIME_TO_EMPTY_AVG, &time_to_empty)) { 209 if (!MPSY_PROP(TIME_TO_EMPTY_AVG, &time_to_empty) ||
211 if (MPSY_PROP(TIME_TO_EMPTY_NOW, &time_to_empty)) 210 !MPSY_PROP(TIME_TO_EMPTY_NOW, &time_to_empty))
212 info->time = calculate_time(status.intval); 211 info->time = time_to_empty.intval / 60;
213 else 212 else
214 info->time = time_to_empty.intval / 60; 213 info->time = calculate_time(status.intval);
215 }
216 } 214 }
217 215
218 up(&power_supply_class->sem); 216 up(&power_supply_class->sem);