[PATCH v2 2/6] console: Implement flush() function

Pali Rohár pali at kernel.org
Fri Aug 12 11:01:30 CEST 2022


On Thursday 11 August 2022 18:08:46 Simon Glass wrote:
> Hi Pali,
> 
> On Thu, 11 Aug 2022 at 08:50, Pali Rohár <pali at kernel.org> wrote:
> >
> > On Thursday 11 August 2022 08:47:50 Simon Glass wrote:
> > > > diff --git a/include/stdio_dev.h b/include/stdio_dev.h
> > > > index 270fa2729fb2..06278366ae88 100644
> > > > --- a/include/stdio_dev.h
> > > > +++ b/include/stdio_dev.h
> > > > @@ -37,6 +37,10 @@ struct stdio_dev {
> > > >         void (*putc)(struct stdio_dev *dev, const char c);
> > > >         /* To put a string (accelerator) */
> > > >         void (*puts)(struct stdio_dev *dev, const char *s);
> > > > +#ifdef CONFIG_CONSOLE_FLUSH_SUPPORT
> > >
> > > I'd argue it isn't worth the #ifdef and we might as well have this
> > > member here always. Then you can drop some #ifdefs from your code.
> >
> > But then it will increase binary code size.
> 
> Using the member will increase code size. But I think the only place
> you need an #ifdef for that is when you include it in the driver
> struct. You can use __maybe_unused in the other place.
> 
> Having the member will only increase memory usage, not code size.

But static memory structures are part of the u-boot.bin binary and also
their usage increase code size (required copy, etc...), so at the end it
increase code size.

> Regards,
> Simon


More information about the U-Boot mailing list