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: Thu, 8 Apr 2021 12:50:43 +1000	[thread overview]
Message-ID: <YG5vgwadkwHBoTsQ@yekko.fritz.box> (raw)
In-Reply-To: <20210405232855.51816-1-ilya.lipnitskiy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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

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?

> ---
>  checks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/checks.c b/checks.c
> index c4207720ce8c..7e9d73af02a3 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -1494,7 +1494,7 @@ static bool prop_is_gpio(struct property *prop)
>  	 * *-gpios and *-gpio can appear in property names,
>  	 * so skip over any false matches (only one known ATM)
>  	 */
> -	if (strstr(prop->name, "nr-gpio"))
> +	if (strstr(prop->name, ",nr-gpios"))
>  		return false;
>  
>  	str = strrchr(prop->name, '-');

-- 
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-08  2:50 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 [this message]
     [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

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=YG5vgwadkwHBoTsQ@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).