powercap/drivers/dtpm: Fix power limit initialization
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Thu, 18 Mar 2021 20:52:38 +0000 (21:52 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Thu, 21 Oct 2021 14:03:31 +0000 (16:03 +0200)
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
drivers/powercap/dtpm.c

index c7c5529..b9fac78 100644 (file)
@@ -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);