Nathan Lynch nathanl@linux.ibm.com writes:
"Aneesh Kumar K.V" aneesh.kumar@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