thermal/sysfs: Update governors when the 'weight' has changed
authorLukasz Luba <lukasz.luba@arm.com>
Wed, 20 Dec 2023 23:17:52 +0000 (23:17 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 29 Dec 2023 17:01:01 +0000 (18:01 +0100)
Support governors update when the thermal instance's weight has changed.
This allows to adjust internal state for the governor.

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
[ rjw: Add two empty code lines aroung the locking ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/thermal_sysfs.c
include/linux/thermal.h

index 299c0fb..f403386 100644 (file)
@@ -939,7 +939,12 @@ ssize_t weight_store(struct device *dev, struct device_attribute *attr,
 
        /* Don't race with governors using the 'weight' value */
        mutex_lock(&instance->tz->lock);
+
        instance->weight = weight;
+
+       thermal_governor_update_tz(instance->tz,
+                                  THERMAL_INSTANCE_WEIGHT_CHANGED);
+
        mutex_unlock(&instance->tz->lock);
 
        return count;
index 4d96fef..9d0427d 100644 (file)
@@ -53,6 +53,7 @@ enum thermal_notify_event {
        THERMAL_EVENT_KEEP_ALIVE, /* Request for user space handler to respond */
        THERMAL_TZ_BIND_CDEV, /* Cooling dev is bind to the thermal zone */
        THERMAL_TZ_UNBIND_CDEV, /* Cooling dev is unbind from the thermal zone */
+       THERMAL_INSTANCE_WEIGHT_CHANGED, /* Thermal instance weight changed */
 };
 
 /**