of/fdt: Consolidate duplicate code into helper functions

Currently, there are many pieces of nearly identical code scattered across
different places. Consolidate the duplicate code into helper functions to
improve maintainability and reduce the likelihood of errors.

Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Link: https://patch.msgid.link/20251115134753.179931-2-yuntao.wang@linux.dev
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
This commit is contained in:
Yuntao Wang
2025-11-15 21:47:46 +08:00
committed by Rob Herring (Arm)
parent a5387fbc66
commit 8278cb72c6
2 changed files with 50 additions and 0 deletions

View File

@@ -55,6 +55,15 @@ extern int of_get_flat_dt_subnode_by_name(unsigned long node,
const char *uname);
extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
int *size);
extern const __be32 *of_flat_dt_get_addr_size_prop(unsigned long node,
const char *name,
int *entries);
extern bool of_flat_dt_get_addr_size(unsigned long node, const char *name,
u64 *addr, u64 *size);
extern void of_flat_dt_read_addr_size(const __be32 *prop, int entry_index,
u64 *addr, u64 *size);
extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
extern unsigned long of_get_flat_dt_root(void);
extern uint32_t of_get_flat_dt_phandle(unsigned long node);