[RFC PATCH for 6.13 v1 18/20] thermal: core: Call __thermal_cdev_update() on cdev unbind

From: Rafael J. Wysocki
Date: Sat Sep 14 2024 - 06:51:39 EST


From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

When deleting a thermal instance from a cooling device's list of thermal
instances, update it in case its state has been determined by the thermal
instance going away.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/thermal/thermal_core.c | 6 ++++++
1 file changed, 6 insertions(+)

Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -864,6 +864,12 @@ static void thermal_instance_delete(stru
guard(cooling_dev)(instance->cdev);

list_del(&instance->cdev_node);
+
+ /*
+ * Update the cdev in case its state has been determined by the thermal
+ * instance going away.
+ */
+ __thermal_cdev_update(instance->cdev);
}

/**