* [PATCH 2/2] drivers: thermal: fix zero weighted request power
@ 2024-05-29 13:52 Chia-Hao Liu
0 siblings, 0 replies; only message in thread
From: Chia-Hao Liu @ 2024-05-29 13:52 UTC (permalink / raw)
To: lukasz.luba
Cc: rafael, daniel.lezcano, rui.zhang, linux-pm, linux-kernel, Chia-Hao Liu
When the product of weight and req_power is less than 1024,
the `frac_to_int()` macro causes the weighted_req_power to
become zero, it will cause granted_power to be zero.
To address issue, I add a check:
If the weight is less than 1024, frac_to_int() is not applied
to avoid setting the weighted_req_power to zero.
Signed-off-by: Chia-Hao Liu <a0921444212@gmail.com>
---
drivers/thermal/gov_power_allocator.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index 336b48745..c878cbb62 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -434,10 +434,10 @@ static void allocate_power(struct thermal_zone_device *tz, int control_temp)
else
weight = instance->weight;
- if (weight < 1024)
- pa->weighted_req_power = weight * pa->req_power;
+ if (weight < 1024)
+ pa->weighted_req_power = weight * pa->req_power;
else
- pa->weighted_req_power = frac_to_int(weight * pa->req_power);
+ pa->weighted_req_power = frac_to_int(weight * pa->req_power);
ret = cdev->ops->state2power(cdev, instance->lower,
&pa->max_power);
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-29 13:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-29 13:52 [PATCH 2/2] drivers: thermal: fix zero weighted request power Chia-Hao Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®