lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZsiSs-OrZRrDBplk@smile.fi.intel.com>
Date: Fri, 23 Aug 2024 16:46:27 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Chen-Yu Tsai <wenst@...omium.org>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	Wolfram Sang <wsa@...nel.org>, Benson Leung <bleung@...omium.org>,
	Tzung-Bi Shih <tzungbi@...nel.org>, Mark Brown <broonie@...nel.org>,
	Liam Girdwood <lgirdwood@...il.com>,
	chrome-platform@...ts.linux.dev, devicetree@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Douglas Anderson <dianders@...omium.org>,
	Johan Hovold <johan@...nel.org>, Jiri Kosina <jikos@...nel.org>,
	linux-i2c@...r.kernel.org
Subject: Re: [PATCH v5 05/10] gpiolib: Add gpio_property_name_length()

On Fri, Aug 23, 2024 at 03:50:55PM +0800, Chen-Yu Tsai wrote:
> On Thu, Aug 22, 2024 at 10:37 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > On Thu, Aug 22, 2024 at 05:19:58PM +0800, Chen-Yu Tsai wrote:

...

> > > +     len = strlen(str);
> >
> > If it has a thousands characters...?
> 
> Shouldn't matter much? I suppose using strrchr() as you suggested
> requires one less pass.

Yes, this is the point.

...

> > This can be combined with the above
> >
> >         for (const char *const *p = gpio_suffixes; *p; p++) {
> >                 /*
> >                  * Find right-most '-' and check if remainder matches suffix.
> >                  * If no separator found, check for no-name cases.
> >                  */
> >                 dash = strrchr(propname, '-');
> 
> I believe this line could be moved out of the for-loop. Otherwise it
> looks much more concise compared to my version. I'll omit the comment
> though, as it is just rehashing the kerneldoc description, and now
> that the function is so short, it shouldn't be hard to read.

Agree. And I put comment inside the loop, while it should be outside. But then,
as you said, the function becomes so little that kernel-doc above does the job,
hence no comment in the code needed.

> I'll add you as "Suggested-by".

Fine with me.

> >                 if (!strcmp(dash ? dash + 1 : propname, *p))
> >                         return i;
> >         }

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ