[PATCH v2 3/4] powerpc/memhotplug: Make lmb size 64bit

Michael Ellerman mpe at ellerman.id.au
Wed Oct 7 16:56:36 AEDT 2020


Nathan Lynch <nathanl at linux.ibm.com> writes:
> "Aneesh Kumar K.V" <aneesh.kumar at linux.ibm.com> writes:
>> @@ -322,12 +322,16 @@ static int pseries_remove_mem_node(struct device_node *np)
>>  	/*
>>  	 * Find the base address and size of the memblock
>>  	 */
>> -	regs = of_get_property(np, "reg", NULL);
>> -	if (!regs)
>> +	prop = of_get_property(np, "reg", NULL);
>> +	if (!prop)
>>  		return ret;
>>  
>> -	base = be64_to_cpu(*(unsigned long *)regs);
>> -	lmb_size = be32_to_cpu(regs[3]);
>> +	/*
>> +	 * "reg" property represents (addr,size) tuple.
>> +	 */
>> +	base = of_read_number(prop, mem_addr_cells);
>> +	prop += mem_addr_cells;
>> +	lmb_size = of_read_number(prop, mem_size_cells);
>
> Would of_n_size_cells() and of_n_addr_cells() work here?

Yes that should work and be cleaner.

cheers


More information about the Linuxppc-dev mailing list