Skip to content

Commit

Permalink
PM / Domains: Return early for all errors in _genpd_power_off()
Browse files Browse the repository at this point in the history
It is strange to only return early for -EBUSY state and left other
errors to be still measured execution time.

As for error cases, the elapsed_ns computed actually is not quite
accurate and meaningful for governor to use. So let's simply return
for all error cases.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Aisheng Dong authored and Rafael J. Wysocki committed Mar 11, 2019
1 parent 46b7fe9 commit 0cec68a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,19 +457,19 @@ static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)

time_start = ktime_get();
ret = genpd->power_off(genpd);
if (ret == -EBUSY)
if (ret)
return ret;

elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
if (elapsed_ns <= genpd->states[state_idx].power_off_latency_ns)
return ret;
return 0;

genpd->states[state_idx].power_off_latency_ns = elapsed_ns;
genpd->max_off_time_changed = true;
pr_debug("%s: Power-%s latency exceeded, new value %lld ns\n",
genpd->name, "off", elapsed_ns);

return ret;
return 0;
}

/**
Expand Down

0 comments on commit 0cec68a

Please sign in to comment.