From 4f97ffefe156a2e0c4d321fe920578cc8a3c8ac4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 10 Mar 2025 15:15:23 +0000 Subject: [PATCH] Revert "thermal: gov_power_allocator: Update total_weight on bind and cdev updates" This reverts commit 27a144c3be8cb7b1e6d09ae63deb9e4a241aedfe which is commit 0cde378a10c1cbfaa8dd2b89672d42f36c2809c3 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ia909785ed95086cc48e2a7cb765bbadf9ed51a8f Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/gov_power_allocator.c | 30 +++++++-------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index 90b4bfd9237b..8a9420527db7 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -635,22 +635,6 @@ clean_state: return ret; } -static void power_allocator_update_weight(struct power_allocator_params *params) -{ - const struct thermal_trip_desc *td; - struct thermal_instance *instance; - - if (!params->trip_max) - return; - - td = trip_to_trip_desc(params->trip_max); - - params->total_weight = 0; - list_for_each_entry(instance, &td->thermal_instances, trip_node) - if (power_actor_is_valid(instance)) - params->total_weight += instance->weight; -} - static void power_allocator_update_tz(struct thermal_zone_device *tz, enum thermal_notify_event reason) { @@ -666,12 +650,16 @@ static void power_allocator_update_tz(struct thermal_zone_device *tz, if (power_actor_is_valid(instance)) num_actors++; - if (num_actors != params->num_actors) - allocate_actors_buffer(params, num_actors); + if (num_actors == params->num_actors) + return; - fallthrough; + allocate_actors_buffer(params, num_actors); + break; case THERMAL_INSTANCE_WEIGHT_CHANGED: - power_allocator_update_weight(params); + params->total_weight = 0; + list_for_each_entry(instance, &td->thermal_instances, trip_node) + if (power_actor_is_valid(instance)) + params->total_weight += instance->weight; break; default: break; @@ -737,8 +725,6 @@ static int power_allocator_bind(struct thermal_zone_device *tz) tz->governor_data = params; - power_allocator_update_weight(params); - return 0; free_params: