Skip to content

Commit

Permalink
powercap/drivers/dtpm: Fix power limit initialization
Browse files Browse the repository at this point in the history
When a DTPM node is registered its power limit must be initialized to
the power max.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210318205238.21937-1-daniel.lezcano@linaro.org
  • Loading branch information
Daniel Lezcano committed Oct 21, 2021
1 parent eb82bac commit 5d8cb8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/powercap/dtpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,10 @@ int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent)
root = dtpm;
}

if (dtpm->ops && !dtpm->ops->update_power_uw(dtpm))
if (dtpm->ops && !dtpm->ops->update_power_uw(dtpm)) {
__dtpm_add_power(dtpm);
dtpm->power_limit = dtpm->power_max;
}

pr_info("Registered dtpm node '%s' / %llu-%llu uW, \n",
dtpm->zone.name, dtpm->power_min, dtpm->power_max);
Expand Down

0 comments on commit 5d8cb8d

Please sign in to comment.