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

Commit 1d15dace authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qos: Fix accessing pm_qos_request struct"

parents 6b4b2f61 defc96f9
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -266,13 +266,21 @@ static const struct file_operations pm_qos_debug_fops = {
	.release        = single_release,
};

static inline void pm_qos_set_value_for_cpus(struct pm_qos_constraints *c,
static inline int pm_qos_set_value_for_cpus(struct pm_qos_constraints *c,
		struct cpumask *cpus)
{
	struct pm_qos_request *req = NULL;
	int cpu;
	s32 qos_val[NR_CPUS] = { [0 ... (NR_CPUS - 1)] = c->default_value };

	/*
	 * pm_qos_constraints can be from different classes,
	 * Update cpumask only only for CPU_DMA_LATENCY classes
	 */

	if (c != pm_qos_array[PM_QOS_CPU_DMA_LATENCY]->constraints)
		return -EINVAL;

	plist_for_each_entry(req, &c->list, node) {
		for_each_cpu(cpu, &req->cpus_affine) {
			switch (c->type) {
@@ -295,6 +303,8 @@ static inline void pm_qos_set_value_for_cpus(struct pm_qos_constraints *c,
			cpumask_set_cpu(cpu, cpus);
		c->target_per_cpu[cpu] = qos_val[cpu];
	}

	return 0;
}

/**
@@ -347,7 +357,7 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
	curr_value = pm_qos_get_value(c);
	cpumask_clear(&cpus);
	pm_qos_set_value(c, curr_value);
	pm_qos_set_value_for_cpus(c, &cpus);
	ret = pm_qos_set_value_for_cpus(c, &cpus);

	spin_unlock_irqrestore(&pm_qos_lock, flags);

@@ -358,7 +368,8 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
	 * to update the new qos restriction for the cores
	 */

	if (!cpumask_empty(&cpus)) {
	if (!cpumask_empty(&cpus) ||
	   (ret && prev_value != curr_value)) {
		ret = 1;
		if (c->notifiers)
			blocking_notifier_call_chain(c->notifiers,