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

Commit 946a6aa7 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Raghavendra Rao Ananta
Browse files

coresight: of: Use of_cpu_node_to_id helper



Reuse the new generic helper, of_cpu_node_to_id() to map a
given CPU phandle to a logical CPU number.

Change-Id: I8ddf46a6ebcd84813759184b9f2df78a769a90a0
Acked-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Git-commit: 29198e3844caaaacb0e21eff634c5f1cfd7f89be
[rananta@codeaurora.org: resolved trivial merge conflicts]
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarRaghavendra Rao Ananta <rananta@codeaurora.org>
parent 646e5c01
Loading
Loading
Loading
Loading
+6 −15
Original line number Diff line number Diff line
@@ -104,26 +104,17 @@ static int of_coresight_alloc_memory(struct device *dev,
int of_coresight_get_cpu(const struct device_node *node)
{
	int cpu;
	bool found;
	struct device_node *dn, *np;
	struct device_node *dn;

	dn = of_parse_phandle(node, "cpu", 0);

	/* Affinity defaults to invalid */
	/* Affinity defaults to CPU0 */
	if (!dn)
		return -ENODEV;

	for_each_possible_cpu(cpu) {
		np = of_cpu_device_node_get(cpu);
		found = (dn == np);
		of_node_put(np);
		if (found)
			break;
	}
		return 0;
	cpu = of_cpu_node_to_id(dn);
	of_node_put(dn);

	/* Affinity to invalid if no cpu nodes are found */
	return found ? cpu : -ENODEV;
	/* Affinity to CPU0 if no cpu nodes are found */
	return (cpu < 0) ? 0 : cpu;
}
EXPORT_SYMBOL_GPL(of_coresight_get_cpu);