[PATCH v3 2/6] arch_topology: drop the use of cpu_node in the pr_info

Jonathan Cameron Jonathan.Cameron at huawei.com
Fri Jul 18 04:12:38 PDT 2025


On Fri, 18 Jul 2025 10:48:44 +0100
Alireza Sanaee <alireza.sanaee at huawei.com> wrote:

> Remove the use of cpu_node in the pr_info. When of_cpu_node_to_id fails,
> it may set a pointer, cpu_node, and the get_cpu_for_node function uses that
> pointer to log further in the fail scenario.
> 
> Also, change the structure to exit early in fail scenarios which will
> help enabling code unification that follows in this series.

So this patch is the trade off to the unification.   Some small
amount of info in the info message is lost.  To me that looks
fine, but others may disagree!

I assume the motivation for not just leaving this one alone is
we ultimately need the flexible handler for the SMT series?

> 
> Signed-off-by: Alireza Sanaee <alireza.sanaee at huawei.com>

Reviewed-by: Jonathan Cameron <jonathan.cameron at huawei.com>

> ---
>  drivers/base/arch_topology.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index 1037169abb45..6fafd86f608a 100644
> --- a/drivers/base/arch_topology.c
> +++ b/drivers/base/arch_topology.c
> @@ -481,12 +481,13 @@ static int __init get_cpu_for_node(struct device_node *node)
>  		return -1;
>  
>  	cpu = of_cpu_node_to_id(cpu_node);
> -	if (cpu >= 0)
> -		topology_parse_cpu_capacity(cpu_node, cpu);
> -	else
> -		pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n",
> -			cpu_node, cpumask_pr_args(cpu_possible_mask));
> +	if (cpu < 0) {
> +		pr_info("CPU node exist but the possible cpu range is :%*pbl\n",
> +			cpumask_pr_args(cpu_possible_mask));
> +		return cpu;
> +	}
>  
> +	topology_parse_cpu_capacity(cpu_node, cpu);
>  	return cpu;
>  }
>  




More information about the linux-arm-kernel mailing list