Re: [PATCH] of: replace strcmp_suffix() with strends()

From: Bartosz Golaszewski
Date: Tue Dec 16 2025 - 11:23:39 EST


On Tue, Dec 16, 2025 at 1:58 PM Rob Herring <robh@xxxxxxxxxx> wrote:
>
> On Tue, Dec 16, 2025 at 1:45 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
> >
> > On Mon, Dec 15, 2025 at 8:44 PM Rob Herring <robh@xxxxxxxxxx> wrote:
> > >
> > > On Mon, Dec 15, 2025 at 04:48:09PM +0100, Bartosz Golaszewski wrote:
> > > > string.h now provides strends() which fulfills the same role as the
> > > > locally implemented strcmp_suffix(). Use it in of/property.c.
> > > >
> > > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
> > > > ---
> > > > @@ -1416,7 +1405,7 @@ DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells")
> > > > static struct device_node *parse_gpios(struct device_node *np,
> > > > const char *prop_name, int index)
> > > > {
> > > > - if (!strcmp_suffix(prop_name, ",nr-gpios"))
> > > > + if (!strends(prop_name, ",nr-gpios"))
> > >
> > > Don't you need to negate these?
> > >
> >
> > I'm not following, am I not negating this?
>
> strcmp() returns 0 on match. strends() returns True on match.
>

Right, I was under the impression strcmp_suffix() had the same
semantics as strends().

Will send v2.

Bart