diff mbox series

[1/2] libfdt: Make fdt_cells function accessible

Message ID 20200408093528.24276-2-matthias.bgg@kernel.org
State New
Headers show
Series Reading size-cells and address-cells from a node should walk up the | expand

Commit Message

Matthias Brugger April 8, 2020, 9:35 a.m. UTC
From: Matthias Brugger <mbrugger at suse.com>

For reading address-cells and size-cells, the libfdt only provides
functions which do not return in case the node does not provide the
property. For traversing the DT to find the parent node which provides
this property we will need to know that.

Make fdt_cells accessible from outside of libfdt so that we can detect
not present size- and address-cells properties in a node.

Signed-off-by: Matthias Brugger <mbrugger at suse.com>
---

 scripts/dtc/libfdt/fdt_addresses.c | 2 +-
 scripts/dtc/libfdt/libfdt.h        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Simon Glass April 9, 2020, 4:25 p.m. UTC | #1
Hi Matthias,

On Wed, 8 Apr 2020 at 03:35, <matthias.bgg at kernel.org> wrote:
>
> From: Matthias Brugger <mbrugger at suse.com>
>
> For reading address-cells and size-cells, the libfdt only provides
> functions which do not return in case the node does not provide the
> property. For traversing the DT to find the parent node which provides
> this property we will need to know that.
>
> Make fdt_cells accessible from outside of libfdt so that we can detect
> not present size- and address-cells properties in a node.
>
> Signed-off-by: Matthias Brugger <mbrugger at suse.com>
> ---
>
>  scripts/dtc/libfdt/fdt_addresses.c | 2 +-
>  scripts/dtc/libfdt/libfdt.h        | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)

Can you please send these patches upstream too?

Thanks,
Simon
diff mbox series

Patch

diff --git a/scripts/dtc/libfdt/fdt_addresses.c b/scripts/dtc/libfdt/fdt_addresses.c
index 9a82cd0ba2..ead9460e95 100644
--- a/scripts/dtc/libfdt/fdt_addresses.c
+++ b/scripts/dtc/libfdt/fdt_addresses.c
@@ -11,7 +11,7 @@ 
 
 #include "libfdt_internal.h"
 
-static int fdt_cells(const void *fdt, int nodeoffset, const char *name)
+int fdt_cells(const void *fdt, int nodeoffset, const char *name)
 {
 	const fdt32_t *c;
 	uint32_t val;
diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h
index fa63fffe28..b0eca12491 100644
--- a/scripts/dtc/libfdt/libfdt.h
+++ b/scripts/dtc/libfdt/libfdt.h
@@ -1121,6 +1121,8 @@  const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
  */
 #define FDT_MAX_NCELLS		4
 
+int fdt_cells(const void *fdt, int nodeoffset, const char *name);
+
 /**
  * fdt_address_cells - retrieve address size for a bus represented in the tree
  * @fdt: pointer to the device tree blob