Re: [PATCH v1 10/15] auxdisplay: linedisp: Provide a small buffer in the struct linedisp

From: Andy Shevchenko
Date: Mon Feb 12 2024 - 11:50:14 EST


On Mon, Feb 12, 2024 at 01:50:13PM +0200, Andy Shevchenko wrote:
> On Mon, Feb 12, 2024 at 09:25:00AM +0100, Robin van der Gracht wrote:
> > On Thu, 8 Feb 2024 20:48:08 +0200
> > Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> > > + linedisp->num_chars = buf ? num_chars : min(num_chars, LINEDISP_DEFAULT_BUF_SZ);
> >
> > It's not a big buffer, but now it's always there even if it's not used.
> > And even if it's used, it might be only partially used.
> > Why not used a malloc instead?
>
> malloc() infra takes more than this IIRC (something like up to 32 bytes on
> 64-bit platforms) or comparable sizes. Yes, the malloc() along with the
> linedisp structure might make sense, but will require more invasive change.
>
> Do you want me to drop this one from the set?
> (I have no hard feelings about it, as I see better way and just having no
> time for taking care about, as it's not the main point of the series.)

Looking again into it, the allocation separately with linedisp structure
is indeed too much invasive. I prefer (as we save lines of code and deduplicate
the buffer at least for two drivers, including a new one) to leave this patch
for now. We may rework it later on. Do you agree?

--
With Best Regards,
Andy Shevchenko