From: Mark Tseng <chun-jen.tseng@mediatek.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
<chun-jen.tseng@mediatek.com>
Subject: [PATCH v2 4/4] cpufreq: mediatek: data safety protect
Date: Fri, 8 Nov 2024 14:39:42 +0800 [thread overview]
Message-ID: <20241108063942.19744-5-chun-jen.tseng@mediatek.com> (raw)
In-Reply-To: <20241108063942.19744-1-chun-jen.tseng@mediatek.com>
get policy data in global lock session avoid get wrong data.
Signed-off-by: Mark Tseng <chun-jen.tseng@mediatek.com>
---
drivers/cpufreq/mediatek-cpufreq.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
index 3369bdd9a348..3303b6d72ea7 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -201,11 +201,11 @@ static bool is_ccifreq_ready(struct mtk_cpu_dvfs_info *info)
static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
unsigned int index)
{
- struct cpufreq_frequency_table *freq_table = policy->freq_table;
- struct clk *cpu_clk = policy->clk;
- struct clk *armpll = clk_get_parent(cpu_clk);
- struct mtk_cpu_dvfs_info *info = policy->driver_data;
- struct device *cpu_dev = info->cpu_dev;
+ struct cpufreq_frequency_table *freq_table;
+ struct clk *cpu_clk;
+ struct clk *armpll;
+ struct mtk_cpu_dvfs_info *info;
+ struct device *cpu_dev;
struct dev_pm_opp *opp;
long freq_hz, pre_freq_hz;
int vproc, pre_vproc, inter_vproc, target_vproc, ret;
@@ -213,6 +213,11 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
mutex_lock(&mtk_policy_lock);
+ freq_table = policy->freq_table;
+ cpu_clk = policy->clk;
+ armpll = clk_get_parent(cpu_clk);
+ info = policy->driver_data;
+ cpu_dev = info->cpu_dev;
inter_vproc = info->intermediate_voltage;
pre_freq_hz = policy->cur * 1000;
--
2.45.2
prev parent reply other threads:[~2024-11-08 6:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 6:39 [PATCH v2 0/4] fixed mediatek-cpufreq has multi policy concurrency issue Mark Tseng
2024-11-08 6:39 ` [PATCH v2 1/4] cpufreq: mediatek: CCI support SoC , the transition_delay set to 10 ms Mark Tseng
2024-11-14 10:22 ` AngeloGioacchino Del Regno
2025-02-14 7:41 ` Chun-Jen Tseng (曾俊仁)
2024-11-08 6:39 ` [PATCH v2 2/4] cpufreq: mediatek: using global lock avoid race condition Mark Tseng
2024-11-08 6:39 ` [PATCH v2 3/4] cpufreq: mediatek: Add CPUFREQ_ASYNC_NOTIFICATION flag Mark Tseng
2024-11-08 6:39 ` Mark Tseng [this message]
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=20241108063942.19744-5-chun-jen.tseng@mediatek.com \
--to=chun-jen.tseng@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=cw00.choi@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=myungjoo.ham@samsung.com \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
/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.