Re: [PATCH 7/8] ACPI: property: Skip MIPI property table without "mipi-img" prefix

Andy Shevchenko
2023-01-20T13:59:46Z

On Fri, Jan 20, 2023 at 12:07:41PM +0000, Sakari Ailus wrote:
> On Thu, Jan 19, 2023 at 06:11:11PM +0200, Andy Shevchenko wrote:
> > On Thu, Jan 19, 2023 at 06:09:26PM +0200, Andy Shevchenko wrote:
> > > On Thu, Jan 19, 2023 at 03:51:33PM +0000, Sakari Ailus wrote:
> > > > On Tue, Jan 17, 2023 at 05:29:54PM +0200, Andy Shevchenko wrote:
> > > > > On Tue, Jan 17, 2023 at 02:22:43PM +0200, Sakari Ailus wrote:

...

> > > > > > + if (memcmp(elements[0].string.pointer, MIPI_IMG_PREFIX,
> > > > > > + sizeof(MIPI_IMG_PREFIX) - 1))
> > > > >
> > > > > str_has_prefix()
> > > >
> > > > str_has_prefix() calls strlen() on prefix on every call. sizeof() will
> > > > generate much less code --- it's just a number.
> > >
> > > Have you tried that? Because the strlen() over const string literals will be
> > > optimized away on compilation time.
> >
> > Probably that's the reason behind __always_inline for that function.
>
> For str_has_prefix() the reason probably is that inlining that function
> generates less code than when not doing so.

Yes and also allows to optimize strlen() away.
So I suggest to use that function.

If assembly is different (WRT strlen("...const literal...") case),
I would like to know the exact configuration options and the code
that makes a call to strlen().

--
With Best Regards,
Andy Shevchenko