aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/power/supply/cpcap-battery.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
index c8c893de00fd..2f55a25addee 100644
--- a/drivers/power/supply/cpcap-battery.c
+++ b/drivers/power/supply/cpcap-battery.c
@@ -476,11 +476,11 @@ static int cpcap_battery_get_property(struct power_supply *psy,
476 val->intval = ddata->config.info.voltage_min_design; 476 val->intval = ddata->config.info.voltage_min_design;
477 break; 477 break;
478 case POWER_SUPPLY_PROP_CURRENT_AVG: 478 case POWER_SUPPLY_PROP_CURRENT_AVG:
479 if (cached) { 479 sample = latest->cc.sample - previous->cc.sample;
480 if (!sample) {
480 val->intval = cpcap_battery_cc_get_avg_current(ddata); 481 val->intval = cpcap_battery_cc_get_avg_current(ddata);
481 break; 482 break;
482 } 483 }
483 sample = latest->cc.sample - previous->cc.sample;
484 accumulator = latest->cc.accumulator - previous->cc.accumulator; 484 accumulator = latest->cc.accumulator - previous->cc.accumulator;
485 val->intval = cpcap_battery_cc_to_ua(ddata, sample, 485 val->intval = cpcap_battery_cc_to_ua(ddata, sample,
486 accumulator, 486 accumulator,
@@ -497,13 +497,13 @@ static int cpcap_battery_get_property(struct power_supply *psy,
497 val->intval = div64_s64(tmp, 100); 497 val->intval = div64_s64(tmp, 100);
498 break; 498 break;
499 case POWER_SUPPLY_PROP_POWER_AVG: 499 case POWER_SUPPLY_PROP_POWER_AVG:
500 if (cached) { 500 sample = latest->cc.sample - previous->cc.sample;
501 if (!sample) {
501 tmp = cpcap_battery_cc_get_avg_current(ddata); 502 tmp = cpcap_battery_cc_get_avg_current(ddata);
502 tmp *= (latest->voltage / 10000); 503 tmp *= (latest->voltage / 10000);
503 val->intval = div64_s64(tmp, 100); 504 val->intval = div64_s64(tmp, 100);
504 break; 505 break;
505 } 506 }
506 sample = latest->cc.sample - previous->cc.sample;
507 accumulator = latest->cc.accumulator - previous->cc.accumulator; 507 accumulator = latest->cc.accumulator - previous->cc.accumulator;
508 tmp = cpcap_battery_cc_to_ua(ddata, sample, accumulator, 508 tmp = cpcap_battery_cc_to_ua(ddata, sample, accumulator,
509 latest->cc.offset); 509 latest->cc.offset);