Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/fdt: avoid re-parsing '#{address,size}-cells' in of_fdt_limit_memory

Now that we initialize dt_root_addr_cells and dt_root_size_cells earlier,
use them and simplify of_fdt_limit_memory.

Link: https://lore.kernel.org/all/20180830190523.31474-3-robh@kernel.org/
Signed-off-by: Rob Herring <robh@kernel.org>

+1 -22
+1 -22
drivers/of/fdt.c
··· 52 52 int memory; 53 53 int len; 54 54 const void *val; 55 - int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; 56 - int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; 57 - const __be32 *addr_prop; 58 - const __be32 *size_prop; 59 - int root_offset; 60 - int cell_size; 61 - 62 - root_offset = fdt_path_offset(initial_boot_params, "/"); 63 - if (root_offset < 0) 64 - return; 65 - 66 - addr_prop = fdt_getprop(initial_boot_params, root_offset, 67 - "#address-cells", NULL); 68 - if (addr_prop) 69 - nr_address_cells = fdt32_to_cpu(*addr_prop); 70 - 71 - size_prop = fdt_getprop(initial_boot_params, root_offset, 72 - "#size-cells", NULL); 73 - if (size_prop) 74 - nr_size_cells = fdt32_to_cpu(*size_prop); 75 - 76 - cell_size = sizeof(uint32_t)*(nr_address_cells + nr_size_cells); 55 + int cell_size = sizeof(uint32_t)*(dt_root_addr_cells + dt_root_size_cells); 77 56 78 57 memory = fdt_path_offset(initial_boot_params, "/memory"); 79 58 if (memory > 0) {