From: Qibo Huang <huangqibo.tech@gmail.com>
To: lukasz.luba@arm.com, rafael@kernel.org
Cc: daniel.lezcano@linaro.org, amitk@kernel.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
rui.zhang@intel.com, Qibo Huang <huangqibo.tech@gmail.com>
Subject: [PATCH] thermal/governors: Fix cooling device setting cooling state failure
Date: Tue, 11 Oct 2022 21:54:41 +0800 [thread overview]
Message-ID: <20221011135441.21166-1-huangqibo.tech@gmail.com> (raw)
Because the __thermal_cdev_update function traverses the
cooling_device->thermal_instances list to obtain the maximum
target state, and then the cooling device sets the maximum
cooling state. However, the power_actor_set_power function
only updates the target value of thermal_zone->thermal_instances
to the target state, and does not update the target value of
cooling_device->thermal_instances, resulting in the target
being 0 all the time.
Signed-off-by: Qibo Huang <huangqibo.tech@gmail.com>
---
drivers/thermal/gov_power_allocator.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index 2d1aeaba38a8..2bdf8d797e3c 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -293,6 +293,7 @@ power_actor_set_power(struct thermal_cooling_device *cdev,
struct thermal_instance *instance, u32 power)
{
unsigned long state;
+ struct thermal_instance *cdev_instance;
int ret;
ret = cdev->ops->power2state(cdev, power, &state);
@@ -300,6 +301,10 @@ power_actor_set_power(struct thermal_cooling_device *cdev,
return ret;
instance->target = clamp_val(state, instance->lower, instance->upper);
+ list_for_each_entry(cdev_instance, &cdev->thermal_instances, cdev_node) {
+ if (cdev_instance->tz->id == instance->tz->id)
+ cdev_instance->target = instance->target;
+ }
mutex_lock(&cdev->lock);
__thermal_cdev_update(cdev);
mutex_unlock(&cdev->lock);
--
2.37.1
next reply other threads:[~2022-10-11 13:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 13:54 Qibo Huang [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-10-11 13:47 Qibo Huang
2022-10-10 14:43 Qibo Huang
2022-10-11 7:51 ` Lukasz Luba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221011135441.21166-1-huangqibo.tech@gmail.com \
--to=huangqibo.tech@gmail.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®