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

Simon Glass
2022-08-12T00:09:21Z

Hi Pali,

On Thu, 11 Aug 2022 at 08:50, Pali Rohár <pali@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.

Regards,
Simon