[PATCH] console: Use flush() before panic and reset

Tony Dinh mibodhi at gmail.com
Wed Mar 15 21:29:28 CET 2023


Hi Simon,

On Wed, Mar 15, 2023 at 12:43 PM Simon Glass <sjg at chromium.org> wrote:
>
> On Tue, 14 Mar 2023 at 18:24, Tony Dinh <mibodhi at gmail.com> wrote:
> >
> > To make sure the panic and the reset messages will go out, console flush() should be used.
> > Sleep periods do not work in early u-boot phase when timer driver is not initialized yet.
> >
> > Reference: https://lists.denx.de/pipermail/u-boot/2023-March/512233.html
> >
> > Signed-off-by: Tony Dinh <mibodhi at gmail.com>
> > ---
> >
> >  arch/arm/lib/reset.c | 4 ++--
> >  lib/panic.c          | 4 +++-
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/lib/reset.c b/arch/arm/lib/reset.c
> > index 95169bae1c..3e051e36f1 100644
> > --- a/arch/arm/lib/reset.c
> > +++ b/arch/arm/lib/reset.c
> > @@ -25,6 +25,7 @@
> >  #include <cpu_func.h>
> >  #include <irq_func.h>
> >  #include <linux/delay.h>
> > +#include <stdio.h>
>
> Reviewed-by: Simon Glass <sjg at chromium.org>
>
> Is flush implemented widely?

Pali wrote that flush function and here was his comment on the
referenced thread:
"Moreover there is already new function named flush() which
does "wait until stdout message was sent" and can be used instead of
those sleeps. I have already did it on some places (see git history for
flush function) but seems that you find some more."

So I think the answer is not yet widely implemented.

All the best,
Tony


More information about the U-Boot mailing list