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

Commit d9e7d036 authored by Chris Redpath's avatar Chris Redpath Committed by Andres Oportus
Browse files

UPSTREAM: cpufreq: schedutil: irq-work and mutex are only used in slow path



Execute the irq-work specific initialization/exit code only when the
fast path isn't available.

Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 21ef57297b15a49b0c4dd4e7135c1a08e9a29a1c)
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
Change-Id: Icfd68f455ef71846d799fcd2d8ec6aa1bf59573e
parent ceed1eb2
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -489,15 +489,12 @@ static struct sugov_policy *sugov_policy_alloc(struct cpufreq_policy *policy)
		return NULL;

	sg_policy->policy = policy;
	init_irq_work(&sg_policy->irq_work, sugov_irq_work);
	mutex_init(&sg_policy->work_lock);
	raw_spin_lock_init(&sg_policy->update_lock);
	return sg_policy;
}

static void sugov_policy_free(struct sugov_policy *sg_policy)
{
	mutex_destroy(&sg_policy->work_lock);
	kfree(sg_policy);
}

@@ -531,6 +528,9 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)

	sg_policy->thread = thread;
	kthread_bind_mask(thread, policy->related_cpus);
	init_irq_work(&sg_policy->irq_work, sugov_irq_work);
	mutex_init(&sg_policy->work_lock);

	wake_up_process(thread);

	return 0;
@@ -544,6 +544,7 @@ static void sugov_kthread_stop(struct sugov_policy *sg_policy)

	flush_kthread_worker(&sg_policy->worker);
	kthread_stop(sg_policy->thread);
	mutex_destroy(&sg_policy->work_lock);
}

static struct sugov_tunables *sugov_tunables_alloc(struct sugov_policy *sg_policy)
@@ -719,9 +720,10 @@ static int sugov_stop(struct cpufreq_policy *policy)

	synchronize_sched();

	if (!policy->fast_switch_enabled) {
		irq_work_sync(&sg_policy->irq_work);
		kthread_cancel_work_sync(&sg_policy->work);

	}
	return 0;
}