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

Commit 1099fb38 authored by Vikram Mulukutla's avatar Vikram Mulukutla
Browse files

drivers: clk: qcom: Move the PM QoS request structure to static data



Keeping the PM QoS request structure on the stack
may not be a good idea since a) it requires additional
annotation and b) if we ever move the QoS add and remove
requests out of the set_rate function (and just use
update inside), the structure needs to be globally
accessible anyway.

Change-Id: I875cb1b4f2a6620a7508b3ec56a721aa6958255a
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent 58fd945b
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -732,6 +732,7 @@ struct cpu_clk_8994 {
	cpumask_t cpumask;
	bool hw_low_power_ctrl;
	struct clk c;
	struct pm_qos_request req;
};

static inline struct cpu_clk_8994 *to_cpu_clk_8994(struct clk *c)
@@ -768,7 +769,6 @@ static void do_nothing(void *unused) { }

static int cpu_clk_8994_set_rate(struct clk *c, unsigned long rate)
{
	struct pm_qos_request req = {0};
	int ret;
	struct cpu_clk_8994 *cpuclk = to_cpu_clk_8994(c);
	bool hw_low_power_ctrl = cpuclk->hw_low_power_ctrl;
@@ -780,9 +780,10 @@ static int cpu_clk_8994_set_rate(struct clk *c, unsigned long rate)
	 * control while the clock rate is being switched.
	 */
	if (hw_low_power_ctrl) {
		req.cpus_affine = cpuclk->cpumask;
		req.type = PM_QOS_REQ_AFFINE_CORES;
		pm_qos_add_request(&req, PM_QOS_CPU_DMA_LATENCY,
		memset(&cpuclk->req, 0, sizeof(cpuclk->req));
		cpuclk->req.cpus_affine = cpuclk->cpumask;
		cpuclk->req.type = PM_QOS_REQ_AFFINE_CORES;
		pm_qos_add_request(&cpuclk->req, PM_QOS_CPU_DMA_LATENCY,
				   CPU_LATENCY_NO_L2_PC_US);

		ret = smp_call_function_any(&cpuclk->cpumask, do_nothing,
@@ -792,7 +793,7 @@ static int cpu_clk_8994_set_rate(struct clk *c, unsigned long rate)
	ret = clk_set_rate(c->parent, rate);

	if (hw_low_power_ctrl)
		pm_qos_remove_request(&req);
		pm_qos_remove_request(&cpuclk->req);

	return ret;
}