When a DTPM node is registered its power limit must be initialized to
the power max.

Signed-off-by: Daniel Lezcano <daniel.lezc...@linaro.org>
---
 drivers/powercap/dtpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index a4784ac2f79b..2f028776cfa8 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -594,8 +594,10 @@ int dtpm_create(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("Created dtpm node '%s' / %llu-%llu uW, \n",
                dtpm->zone.name, dtpm->power_min, dtpm->power_max);
-- 
2.17.1

Reply via email to