[PATCH 4/7] lib: utils/serial: Skip initialize serial when dt is not enabled

Anup Patel anup at brainfault.org
Thu Jun 13 06:26:04 PDT 2024


On Tue, Jun 11, 2024 at 4:49 PM Xiang W <wxjstz at 126.com> wrote:
>
> When the dt node has a status property and the value is not ok or
> okay, skip initializing serial.
>
> Signed-off-by: Xiang W <wxjstz at 126.com>

LGTM.

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

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  lib/utils/serial/fdt_serial.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/lib/utils/serial/fdt_serial.c b/lib/utils/serial/fdt_serial.c
> index 0baa722..8b6e6b9 100644
> --- a/lib/utils/serial/fdt_serial.c
> +++ b/lib/utils/serial/fdt_serial.c
> @@ -40,6 +40,10 @@ int fdt_serial_init(void)
>                         else
>                                 noff = fdt_path_offset(fdt, prop);
>                 }
> +               if (-1 < noff) {
> +                       if (!fdt_node_is_enabled(fdt, noff))
> +                               noff = -1;
> +               }
>         }
>
>         /* First check DT node pointed by stdout-path */
> @@ -68,6 +72,9 @@ int fdt_serial_init(void)
>                 if (noff < 0)
>                         continue;
>
> +               if (!fdt_node_is_enabled(fdt, noff))
> +                       continue;
> +
>                 /* drv->init must not be NULL */
>                 if (drv->init == NULL)
>                         return SBI_EFAIL;
> --
> 2.43.0
>



More information about the opensbi mailing list