[PATCH 08/10] platform: generic: Initialize overrides with fdt_driver

Anup Patel anup at brainfault.org
Tue Apr 22 20:56:17 PDT 2025


On Wed, Mar 26, 2025 at 5:13 AM Samuel Holland
<samuel.holland at sifive.com> wrote:
>
> In addition to deduplicating the code, this also improves the match
> selection logic to respect the priority order of the compatible strings,
> as implemented in commit 0ffe265fd969 ("lib: utils/fdt: Respect
> compatible string fallback priority").
>
> Signed-off-by: Samuel Holland <samuel.holland at sifive.com>

LGTM.

Reviewed-by: Anup Patel <anup at brainfault.org>

Regards,
Anup

> ---
>
>  platform/generic/platform.c | 27 +--------------------------
>  1 file changed, 1 insertion(+), 26 deletions(-)
>
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index 19566e69..04448d71 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -33,31 +33,6 @@
>  /* List of platform override modules generated at compile time */
>  extern const struct fdt_driver *const platform_override_modules[];
>
> -static void fw_platform_lookup_special(const void *fdt, int root_offset)
> -{
> -       const struct fdt_driver *plat;
> -       const struct fdt_match *match;
> -       int pos, rc;
> -
> -       for (pos = 0; platform_override_modules[pos]; pos++) {
> -               plat = platform_override_modules[pos];
> -               if (!plat->match_table)
> -                       continue;
> -
> -               match = fdt_match_node(fdt, root_offset, plat->match_table);
> -               if (!match)
> -                       continue;
> -
> -               if (plat->init) {
> -                       rc = plat->init(fdt, root_offset, match);
> -                       if (rc)
> -                               continue;
> -               }
> -
> -               break;
> -       }
> -}
> -
>  static u32 fw_platform_calculate_heap_size(u32 hart_count)
>  {
>         u32 heap_size;
> @@ -177,7 +152,7 @@ unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,
>         if (root_offset < 0)
>                 goto fail;
>
> -       fw_platform_lookup_special(fdt, root_offset);
> +       fdt_driver_init_by_offset(fdt, root_offset, platform_override_modules);
>
>         model = fdt_getprop(fdt, root_offset, "model", &len);
>         if (model)
> --
> 2.47.2
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list