Re: [PATCH v3] checks: tigthen up nr-gpios prop exception

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxx>
> Cc: Rob Herring <robh+dt@xxxxxxxxxx>

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: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux