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

Xiang W wxjstz at 126.com
Tue Jun 11 04:31:53 PDT 2024


在 2024-06-11星期二的 14:32 +0530,Anup Patel写道:
> 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.
Thanks for review.

New patch at:
https://patchwork.ozlabs.org/project/opensbi/list/?series=410357

Regards,
Xiang W
> 
> 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