Skip to content

Commit

Permalink
thermal/sysfs: Update governors when the 'weight' has changed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lukasz Luba authored and Rafael J. Wysocki committed Dec 29, 2023
1 parent 879c9dc commit bfc57bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/thermal/thermal_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions include/linux/thermal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

/**
Expand Down

0 comments on commit bfc57bd

Please sign in to comment.