* [PATCH] of: reserved-memory: remove duplicated call to of_get_flat_dt_prop() for no-map node
@ 2020-07-30 9:23 Yue Hu
2020-08-03 22:50 ` Rob Herring
0 siblings, 1 reply; 2+ messages in thread
From: Yue Hu @ 2020-07-30 9:23 UTC (permalink / raw)
To: robh+dt, frowand.list; +Cc: devicetree, linux-kernel, huyue2, zbestahu
From: Yue Hu <huyue2@yulong.com>
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: Yue Hu <huyue2@yulong.com>
---
drivers/of/of_reserved_mem.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 6877080..c255c7e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -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
- * 'size', 'align' and 'alloc-ranges' properties.
+ * 'size', 'alignment' and 'alloc-ranges' properties.
*/
static int __init __reserved_mem_alloc_size(unsigned long node,
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,
phys_addr_t base = 0, align = 0, size;
int len;
const __be32 *prop;
- int nomap;
+ bool nomap;
int ret;
prop = of_get_flat_dt_prop(node, "size", &len);
@@ -92,8 +92,6 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
}
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);
if (prop) {
if (len != dt_root_addr_cells * sizeof(__be32)) {
@@ -104,11 +102,13 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
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 */
if (IS_ENABLED(CONFIG_CMA)
&& of_flat_dt_is_compatible(node, "shared-dma-pool")
&& of_get_flat_dt_prop(node, "reusable", NULL)
- && !of_get_flat_dt_prop(node, "no-map", NULL)) {
+ && !nomap) {
unsigned long order =
max_t(unsigned long, MAX_ORDER - 1, pageblock_order);
@@ -247,7 +247,7 @@ void __init fdt_init_reserved_mem(void)
int len;
const __be32 *prop;
int err = 0;
- int nomap;
+ bool nomap;
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
prop = of_get_flat_dt_prop(node, "phandle", &len);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] of: reserved-memory: remove duplicated call to of_get_flat_dt_prop() for no-map node
2020-07-30 9:23 [PATCH] of: reserved-memory: remove duplicated call to of_get_flat_dt_prop() for no-map node Yue Hu
@ 2020-08-03 22:50 ` Rob Herring
0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2020-08-03 22:50 UTC (permalink / raw)
To: Yue Hu; +Cc: devicetree, robh+dt, huyue2, zbestahu, frowand.list, linux-kernel
On Thu, 30 Jul 2020 17:23:53 +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
>
> 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: Yue Hu <huyue2@yulong.com>
> ---
> drivers/of/of_reserved_mem.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-03 22:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 9:23 [PATCH] of: reserved-memory: remove duplicated call to of_get_flat_dt_prop() for no-map node Yue Hu
2020-08-03 22:50 ` Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).