From f3c141057976120148ca32d9d030a2256a5ffb7b Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 24 Feb 2021 19:30:21 +0100 Subject: [PATCH 1/2] powercap/drivers/dtpm: Fix root node initialization The root node is not set to NULL when the dtpm root node is removed. Consequently, it is not possible to create a new root as it is already set. Set the root node to NULL when the last node is removed. Signed-off-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki --- drivers/powercap/dtpm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c index 5a51cd34a7e87..c2185ec5f887b 100644 --- a/drivers/powercap/dtpm.c +++ b/drivers/powercap/dtpm.c @@ -207,6 +207,9 @@ int dtpm_release_zone(struct powercap_zone *pcz) if (dtpm->ops) dtpm->ops->release(dtpm); + if (root == dtpm) + root = NULL; + kfree(dtpm); return 0; From 9e2be308f023a741a0d4024bef508ef88dfb3a43 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 24 Feb 2021 19:30:22 +0100 Subject: [PATCH 2/2] powercap/drivers/dtpm: Add the experimental label to the option description The DTPM framework will evolve in the next cycles. Let's add a temporary EXPERIMENTAL tag to the option so users will be aware the API may change over time. Signed-off-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki --- drivers/powercap/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/powercap/Kconfig b/drivers/powercap/Kconfig index 20b4325c6161c..8242e8c5ed77e 100644 --- a/drivers/powercap/Kconfig +++ b/drivers/powercap/Kconfig @@ -45,7 +45,7 @@ config IDLE_INJECT on a per CPU basis. config DTPM - bool "Power capping for Dynamic Thermal Power Management" + bool "Power capping for Dynamic Thermal Power Management (EXPERIMENTAL)" help This enables support for the power capping for the dynamic thermal power management userspace engine.