devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Ilya Lipnitskiy
	<ilya.lipnitskiy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jon Loeliger <loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v3] checks: tigthen up nr-gpios prop exception
Date: Mon, 12 Apr 2021 14:30:25 +1000	[thread overview]
Message-ID: <YHPM4Rg9bqbXTp0W@yekko.fritz.box> (raw)
In-Reply-To: <CALCv0x0ra=UYRQi9XPabs=aCCC==Cdt2-NoPMqY6YkbHX+8yCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2050 bytes --]

On Sat, Apr 10, 2021 at 11:20:54AM -0700, Ilya Lipnitskiy wrote:
> On Wed, Apr 7, 2021 at 7:59 PM David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> >
> > On Mon, Apr 05, 2021 at 04:28:55PM -0700, Ilya Lipnitskiy wrote:
> > > There are no instances of nr-gpio in the Linux kernel tree, only
> > > "[<vendor>,]nr-gpios", so make the check stricter.
> > >
> > > nr-gpios without a "vendor," prefix is also invalid, according to the DT
> > > spec[0], and there are no DT files in the Linux kernel tree with
> > > non-vendor nr-gpios. There are some drivers, but they are not DT spec
> > > compliant, so don't suppress the check for them.
> > >
> > > [0]:
> > > Link: https://github.com/devicetree-org/dt-schema/blob/cb53a16a1eb3e2169ce170c071e47940845ec26e/schemas/gpio/gpio-consumer.yaml#L20
> > >
> > > Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> >
> > Applied, since it looks like it definitely improves the current
> > situation.
> >
> > The use of strstr() at all seems kind of bogus to me.  Shouldn't we
> > explicitly be checking that ",nr-gpios" forms the *end* of the
> > property name?
> Yeah, I noticed that too. We could replace strstr with something
> similar to strcmp_suffix in drivers/of/property.c:
> 
> static int strcmp_suffix(const char *str, const char *suffix)
> {
>         unsigned int len, suffix_len;
> 
>         len = strlen(str);
>         suffix_len = strlen(suffix);
>         if (len <= suffix_len)
>                 return -1;
>         return strcmp(str + len - suffix_len, suffix);
> }

Right.  If you add something like this, you should reverse the sense
and call it 'strends' to match 'strstarts' which we already define in
dtc.h.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2021-04-12  4:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04 23:50 [PATCH] checks: stop allowing nr-gpio, only allow nr-gpios Ilya Lipnitskiy
     [not found] ` <20210404235042.630817-1-ilya.lipnitskiy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2021-04-05  5:26   ` [PATCH v2] checks: tigthen up nr-gpios prop exception Ilya Lipnitskiy
     [not found]     ` <20210405052617.2471954-1-ilya.lipnitskiy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2021-04-05 23:28       ` [PATCH v3] " Ilya Lipnitskiy
     [not found]         ` <20210405232855.51816-1-ilya.lipnitskiy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2021-04-08  2:50           ` David Gibson
     [not found]             ` <YG5vgwadkwHBoTsQ-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
2021-04-10 18:20               ` Ilya Lipnitskiy
     [not found]                 ` <CALCv0x0ra=UYRQi9XPabs=aCCC==Cdt2-NoPMqY6YkbHX+8yCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-04-12  4:30                   ` David Gibson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHPM4Rg9bqbXTp0W@yekko.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ilya.lipnitskiy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).