Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b638af72 authored by Junjie Wu's avatar Junjie Wu
Browse files

qcom-cpufreq: Fix hotplug blocking logic



Change 2b63b109 qcom-cpufreq: Block hotplug until cpufreq is ready
intended to block hotplug until qcom-cpufreq driver has got all
clocks. However, its implementation still leaves a small window when
CPU 0 has got its clock but others haven't. If a hotplug happens on
another CPU that doesn't have its clock pointer, refcount of that CPU
clock will again be wrong.

Fix the issue by introducing a ready flag.

Change-Id: I1e05b063b0584088f717b82709a3f1d55bc6561b
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent bfaea932
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ static struct cpufreq_frequency_table *freq_table;
static unsigned int *l2_khz;
static bool is_sync;
static unsigned long *mem_bw;
static bool hotplug_ready;

struct cpufreq_work_struct {
	struct work_struct work;
@@ -295,7 +296,7 @@ static int msm_cpufreq_cpu_callback(struct notifier_block *nfb,
	int rc;

	/* Fail hotplug until this driver can get CPU clocks */
	if (!cpu_clk[0])
	if (!hotplug_ready)
		return NOTIFY_BAD;

	switch (action & ~CPU_TASKS_FROZEN) {
@@ -568,6 +569,7 @@ static int __init msm_cpufreq_probe(struct platform_device *pdev)

	if (!cpu_clk[0])
		return -ENODEV;
	hotplug_ready = true;

	ret = cpufreq_parse_dt(dev);
	if (ret)