Commit 6f1188b4 authored by Yue Hu's avatar Yue Hu Committed by Rob Herring

of: reserved-memory: remove duplicated call to of_get_flat_dt_prop() for no-map node

Just use nomap instead of the second call to of_get_flat_dt_prop(). And
change nomap as a bool type due to != NULL operator. Also, correct comment
about node of 'align' -> 'alignment'.
Signed-off-by: default avatarYue Hu <huyue2@yulong.com>
Link: https://lore.kernel.org/r/20200730092353.15644-1-zbestahu@gmail.comSigned-off-by: default avatarRob Herring <robh@kernel.org>
parent bda21278
...@@ -69,7 +69,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, ...@@ -69,7 +69,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname,
/** /**
* __reserved_mem_alloc_size() - allocate reserved memory described by * __reserved_mem_alloc_size() - allocate reserved memory described by
* 'size', 'align' and 'alloc-ranges' properties. * 'size', 'alignment' and 'alloc-ranges' properties.
*/ */
static int __init __reserved_mem_alloc_size(unsigned long node, static int __init __reserved_mem_alloc_size(unsigned long node,
const char *uname, phys_addr_t *res_base, phys_addr_t *res_size) const char *uname, phys_addr_t *res_base, phys_addr_t *res_size)
...@@ -79,7 +79,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ...@@ -79,7 +79,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
phys_addr_t base = 0, align = 0, size; phys_addr_t base = 0, align = 0, size;
int len; int len;
const __be32 *prop; const __be32 *prop;
int nomap; bool nomap;
int ret; int ret;
prop = of_get_flat_dt_prop(node, "size", &len); prop = of_get_flat_dt_prop(node, "size", &len);
...@@ -92,8 +92,6 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ...@@ -92,8 +92,6 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
} }
size = dt_mem_next_cell(dt_root_size_cells, &prop); size = dt_mem_next_cell(dt_root_size_cells, &prop);
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
prop = of_get_flat_dt_prop(node, "alignment", &len); prop = of_get_flat_dt_prop(node, "alignment", &len);
if (prop) { if (prop) {
if (len != dt_root_addr_cells * sizeof(__be32)) { if (len != dt_root_addr_cells * sizeof(__be32)) {
...@@ -104,11 +102,13 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ...@@ -104,11 +102,13 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
align = dt_mem_next_cell(dt_root_addr_cells, &prop); align = dt_mem_next_cell(dt_root_addr_cells, &prop);
} }
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
/* Need adjust the alignment to satisfy the CMA requirement */ /* Need adjust the alignment to satisfy the CMA requirement */
if (IS_ENABLED(CONFIG_CMA) if (IS_ENABLED(CONFIG_CMA)
&& of_flat_dt_is_compatible(node, "shared-dma-pool") && of_flat_dt_is_compatible(node, "shared-dma-pool")
&& of_get_flat_dt_prop(node, "reusable", NULL) && of_get_flat_dt_prop(node, "reusable", NULL)
&& !of_get_flat_dt_prop(node, "no-map", NULL)) { && !nomap) {
unsigned long order = unsigned long order =
max_t(unsigned long, MAX_ORDER - 1, pageblock_order); max_t(unsigned long, MAX_ORDER - 1, pageblock_order);
...@@ -247,7 +247,7 @@ void __init fdt_init_reserved_mem(void) ...@@ -247,7 +247,7 @@ void __init fdt_init_reserved_mem(void)
int len; int len;
const __be32 *prop; const __be32 *prop;
int err = 0; int err = 0;
int nomap; bool nomap;
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL; nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
prop = of_get_flat_dt_prop(node, "phandle", &len); prop = of_get_flat_dt_prop(node, "phandle", &len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment