Skip to contentSkip to conversation

powercap/drivers/dtpm : Fix power limit initialization

PATCH New Daniel Lezcano 1 participant 1 message Mar 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powercap/drivers/dtpm : Fix power limit initialization

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

---
 drivers/powercap/dtpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/powercap/dtpm.c +3 -1
index a4784ac2f79b..2f028776cfa8 100644
@@ -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);
Signature · 1 line
2.17.1