diff options
| author | Lad Prabhakar <[email protected]> | 2022-12-02 11:59:47 +0000 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2022-12-05 17:54:45 +0530 |
| commit | e9775120f554d35b92fcdeb2c3ad8ee8140396e8 (patch) | |
| tree | 7f81e4e1c5527f6c44ff5ba61a6eb3cc547c581c | |
| parent | 4640d041d3ccb13c07c10f811199bae08448e91a (diff) | |
lib: utils: Add fdt_fixup_node() helper function
Add a helper function fdt_fixup_node() based on the compatible string.
This will avoid code duplication for every new node fixup being added.
Signed-off-by: Lad Prabhakar <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Xiang W <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/utils/fdt/fdt_fixup.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c index d1050bbc..41f6cbb7 100644 --- a/lib/utils/fdt/fdt_fixup.c +++ b/lib/utils/fdt/fdt_fixup.c @@ -74,22 +74,23 @@ static void fdt_domain_based_fixup_one(void *fdt, int nodeoff) } } -void fdt_aplic_fixup(void *fdt) +static void fdt_fixup_node(void *fdt, const char *compatible) { int noff = 0; while ((noff = fdt_node_offset_by_compatible(fdt, noff, - "riscv,aplic")) >= 0) + compatible)) >= 0) fdt_domain_based_fixup_one(fdt, noff); } -void fdt_imsic_fixup(void *fdt) +void fdt_aplic_fixup(void *fdt) { - int noff = 0; + fdt_fixup_node(fdt, "riscv,aplic"); +} - while ((noff = fdt_node_offset_by_compatible(fdt, noff, - "riscv,imsics")) >= 0) - fdt_domain_based_fixup_one(fdt, noff); +void fdt_imsic_fixup(void *fdt) +{ + fdt_fixup_node(fdt, "riscv,imsics"); } void fdt_plic_fixup(void *fdt) |
