[PATCH] lib: utils/fdt: fdt_find_match skip disabled node

Anup Patel anup at brainfault.org
Tue Jun 11 02:02:17 PDT 2024


On Mon, May 27, 2024 at 7:26 AM Xiang W <wxjstz at 126.com> wrote:
>
> Some node in devicetree are disabled and need to be skipped during
> initialization.

The fdt_find_match() only finds matching DT nodes irrespective
of the status of the DT node.

Instead of changing the behavior of fdt_find_match(), the
fdt_node_is_enabled() should be called separately by individual
driver frameworks.

Regards,
Anup

>
> Signed-off-by: Xiang W <wxjstz at 126.com>
> ---
>  lib/utils/fdt/fdt_helper.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c
> index a0e93b9..ef627b7 100644
> --- a/lib/utils/fdt/fdt_helper.c
> +++ b/lib/utils/fdt/fdt_helper.c
> @@ -65,9 +65,11 @@ int fdt_find_match(void *fdt, int startoff,
>                 nodeoff = fdt_node_offset_by_compatible(fdt, startoff,
>                                                 match_table->compatible);
>                 if (nodeoff >= 0) {
> -                       if (out_match)
> -                               *out_match = match_table;
> -                       return nodeoff;
> +                       if (fdt_node_is_enabled(fdt, nodeoff)) {
> +                               if (out_match)
> +                                       *out_match = match_table;
> +                               return nodeoff;
> +                       }
>                 }
>                 match_table++;
>         }
> --
> 2.43.0
>



More information about the opensbi mailing list