All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhuguangqing83@gmail.com
To: viresh.kumar@linaro.org, amit.kachhap@gmail.com,
	daniel.lezcano@linaro.org, javi.merino@kernel.org,
	rui.zhang@intel.com, amitk@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zhuguangqing <zhuguangqing@xiaomi.com>,
	"v5 . 4+" <stable@vger.kernel.org>
Subject: [PATCH v2] thermal/drivers/cpufreq_cooling: Update cpufreq_state only if state has changed
Date: Fri,  6 Nov 2020 17:22:43 +0800	[thread overview]
Message-ID: <20201106092243.15574-1-zhuguangqing83@gmail.com> (raw)

From: Zhuguangqing <zhuguangqing@xiaomi.com>

If state has not changed successfully and we updated cpufreq_state,
next time when the new state is equal to cpufreq_state (not changed
successfully last time), we will return directly and miss a
freq_qos_update_request() that should have been.

Fixes: 5130802ddbb1 ("thermal: cpu_cooling: Switch to QoS requests for freq limits")
Cc: v5.4+ <stable@vger.kernel.org> # v5.4+
Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
v2:
  - Add Fixes: 5130802ddbb1 in log.
  - Add Cc: v5.4+ <stable@vger.kernel.org> # v5.4+ in log.
  - Add Acked-by: Viresh Kumar <viresh.kumar@linaro.org> in log.
  - Delete an extra blank line.
---
 drivers/thermal/cpufreq_cooling.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index cc2959f22f01..612f063c1cfc 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -438,13 +438,11 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
 	if (cpufreq_cdev->cpufreq_state == state)
 		return 0;
 
-	cpufreq_cdev->cpufreq_state = state;
-
 	frequency = get_state_freq(cpufreq_cdev, state);
 
 	ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency);
-
 	if (ret > 0) {
+		cpufreq_cdev->cpufreq_state = state;
 		cpus = cpufreq_cdev->policy->cpus;
 		max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus));
 		capacity = frequency * max_capacity;
-- 
2.17.1


             reply	other threads:[~2020-11-06  9:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06  9:22 zhuguangqing83 [this message]
2020-11-06  9:25 ` [PATCH v2] thermal/drivers/cpufreq_cooling: Update cpufreq_state only if state has changed Viresh Kumar
2020-11-12 11:24 ` Daniel Lezcano
2020-11-24  9:36 ` [thermal: thermal/next] " thermal-bot for Zhuguangqing
  -- strict thread matches above, loose matches on Subject: below --
2020-11-06  9:14 [PATCH v2] " zhuguangqing83

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=20201106092243.15574-1-zhuguangqing83@gmail.com \
    --to=zhuguangqing83@gmail.com \
    --cc=amit.kachhap@gmail.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=javi.merino@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=zhuguangqing@xiaomi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.