diff options
author | Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> | 2022-12-02 14:59:47 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2022-12-05 15:24:45 +0300 |
commit | e9775120f554d35b92fcdeb2c3ad8ee8140396e8 (patch) | |
tree | 7f81e4e1c5527f6c44ff5ba61a6eb3cc547c581c | |
parent | 4640d041d3ccb13c07c10f811199bae08448e91a (diff) | |
download | opensbi-e9775120f554d35b92fcdeb2c3ad8ee8140396e8.tar.xz |
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 <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
-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 d1050bb..41f6cbb 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) |