devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravana Kannan <saravanak@google.com>
To: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH] of: property: do not create device links from *nr-gpios
Date: Mon, 5 Apr 2021 13:00:40 -0700	[thread overview]
Message-ID: <CAGETcx9ifDoWeBN1KR4zKfs-q73iGo9C-joz4UqayeE3euDQWg@mail.gmail.com> (raw)
In-Reply-To: <20210405031436.2465475-1-ilya.lipnitskiy@gmail.com>

On Sun, Apr 4, 2021 at 8:14 PM Ilya Lipnitskiy
<ilya.lipnitskiy@gmail.com> wrote:
>
> [<vendor>,]nr-gpios property is used by some GPIO drivers[0] to indicate
> the number of GPIOs present on a system, not define a GPIO. nr-gpios is
> not configured by #gpio-cells and can't be parsed along with other
> "*-gpios" properties.
>
> scripts/dtc/checks.c also has a special case for nr-gpio{s}. However,
> nr-gpio is not really special, so we only need to fix nr-gpios suffix
> here.

The only example of this that I see is "snps,nr-gpios". I personally
would like to deprecate such overlapping/ambiguous definitions.

Maybe fix up the DT? This warning is a nice reminder that the DT needs
to be updated (if it can be). Outside of that, it's not causing any
issues that I know of.

If they are, then we can pick up a patch similar to this. I'd also
limit this fix to "snps,nr-gpios" so that future attempts to use
-gpios for anything other than listing GPIOs triggers a warning.

Rob, thoughts?

Thanks,
Saravana

>
> [0]: nr-gpios is referenced in Documentation/devicetree/bindings/gpio:
>  - gpio-adnp.txt
>  - gpio-xgene-sb.txt
>  - gpio-xlp.txt
>  - snps,dw-apb-gpio.yaml
>
> Fixes errors such as:
>   OF: /palmbus@300000/gpio@600: could not find phandle
>
> Call Trace:
>   of_phandle_iterator_next+0x8c/0x16c
>   __of_parse_phandle_with_args+0x38/0xb8
>   of_parse_phandle_with_args+0x28/0x3c
>   parse_suffix_prop_cells+0x80/0xac
>   parse_gpios+0x20/0x2c
>   of_link_to_suppliers+0x18c/0x288
>   of_link_to_suppliers+0x1fc/0x288
>   device_add+0x4e0/0x734
>   of_platform_device_create_pdata+0xb8/0xfc
>   of_platform_bus_create+0x170/0x214
>   of_platform_populate+0x88/0xf4
>   __dt_register_buses+0xbc/0xf0
>   plat_of_setup+0x1c/0x34
>
> Fixes: 7f00be96f125 ("of: property: Add device link support for interrupt-parent, dmas and -gpio(s)")
> Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
> Cc: Saravana Kannan <saravanak@google.com>
> Cc: <stable@vger.kernel.org> # 5.5.x
> ---
>  drivers/of/property.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 2bb3158c9e43..24672c295603 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1271,7 +1271,16 @@ DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL)
>  DEFINE_SIMPLE_PROP(remote_endpoint, "remote-endpoint", NULL)
>  DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
>  DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells")
> -DEFINE_SUFFIX_PROP(gpios, "-gpios", "#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"))
> +               return NULL;
> +
> +       return parse_suffix_prop_cells(np, prop_name, index, "-gpios",
> +                                      "#gpio-cells");
> +}
>
>  static struct device_node *parse_iommu_maps(struct device_node *np,
>                                             const char *prop_name, int index)
> --
> 2.31.1
>

  reply	other threads:[~2021-04-05 20:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05  3:14 [PATCH] of: property: do not create device links from *nr-gpios Ilya Lipnitskiy
2021-04-05 20:00 ` Saravana Kannan [this message]
2021-04-05 20:10   ` Ilya Lipnitskiy
2021-04-05 20:18     ` Saravana Kannan
2021-04-05 20:55       ` Ilya Lipnitskiy
2021-04-06 17:40       ` Rob Herring
2021-04-06 19:28         ` Ilya Lipnitskiy
2021-04-06 21:28           ` Saravana Kannan
2021-04-06 22:31             ` Rob Herring
2021-04-05 22:25 ` [PATCH v2] of: property: fw_devlink: do not link ".*,nr-gpios" Ilya Lipnitskiy
2021-04-06 23:09   ` Saravana Kannan
2021-04-07  0:34     ` Rob Herring
2021-04-07  0:45       ` Saravana Kannan
2021-04-07  1:10         ` Rob Herring
2021-04-07  1:24           ` Saravana Kannan
2021-04-07 20:44             ` Ilya Lipnitskiy
2021-04-09 19:26               ` Rob Herring
2021-04-09 19:36                 ` Saravana Kannan
2021-04-10 12:08                   ` Greg Kroah-Hartman
2021-04-10  8:56             ` Greg Kroah-Hartman

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=CAGETcx9ifDoWeBN1KR4zKfs-q73iGo9C-joz4UqayeE3euDQWg@mail.gmail.com \
    --to=saravanak@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=ilya.lipnitskiy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=stable@vger.kernel.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).