[PATCH 2/2] powerpc: Use ibm,chip-id property to compute cpu_core_mask if available

Stephen Rothwell sfr at canb.auug.org.au
Mon Aug 12 15:02:00 EST 2013


Hi Paul,

On Sat, 10 Aug 2013 13:46:15 +1000 Paul Mackerras <paulus at samba.org> wrote:
>
> +static void traverse_siblings_chip_id(int cpu, int add, int chipid)

Again, the "add is a boolean.

> +{
> +	const struct cpumask *mask;
> +	struct device_node *np;
> +	int i, plen;
> +	const int *prop;
> +
> +	mask = add ? cpu_online_mask : cpu_present_mask;
> +	for_each_cpu(i, mask) {
> +		np = of_get_cpu_node(i, NULL);
> +		if (!np)
> +			continue;
> +		prop = of_get_property(np, "ibm,chip-id", &plen);
> +		if (prop && plen == sizeof(int) && *prop == chipid) {
                                                   ^^^^^
You should be using of_read_number(), I think.

>  static void traverse_core_siblings(int cpu, int add)
>  {
> -	struct device_node *l2_cache;
> +	struct device_node *l2_cache, *np;
>  	const struct cpumask *mask;
> -	int i;
> +	int i, chip, plen;
> +	const int *prop;
> +
> +	/* First see if we have ibm,chip-id properties in cpu nodes */
> +	np = of_get_cpu_node(cpu, NULL);
> +	if (np) {
> +		chip = -1;
> +		prop = of_get_property(np, "ibm,chip-id", &plen);
> +		if (prop && plen == sizeof(int))
> +			chip = *(int *)prop;

Here as well.

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130812/ec2d25ed/attachment.sig>


More information about the Linuxppc-dev mailing list