From: Saravana Kannan <saravanak@google.com>
To: Frank Rowand <frowand.list@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Android Kernel Team <kernel-team@android.com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/2] of: property: Add device link support for pinctrl-0 through pinctrl-8
Date: Wed, 22 Jul 2020 18:01:57 -0700 [thread overview]
Message-ID: <CAGETcx-CajYnh=ZOkGBxrSUHe0uTAwJ_gZ8EJV1jrq-jNmaBVw@mail.gmail.com> (raw)
In-Reply-To: <084158b7-f6dc-167f-b06d-db617fb2df29@gmail.com>
On Wed, Jul 22, 2020 at 1:56 PM Frank Rowand <frowand.list@gmail.com> wrote:
>
> On 2020-07-22 15:13, Saravana Kannan wrote:
> > Add support for pinctrl-0 through pinctrl-8 explicitly instead of trying
> > to add support for pinctrl-%d properties.
> >
> > Of all the pinctrl-* properties in dts files (20322), only 47% (9531)
> > are pinctrl-%d properties. Of all the pinctrl-%d properties, 99.5%
> > (9486) are made up of pinctrl-[0-2].
> >
> > Trying to parse all pinctrl-* properties and checking for pinctrl-%d is
> > unnecessarily complicated. So, just add support for pinctrl-[0-8] for
> > now. In the unlikely event we ever exceed pinctrl-8, we can come back
> > and improve this.
>
> If you were to implement the more general pinctrl-* case, roughly what would
> it look like (pseudo-code or english description is fine).
So when I say "unnecessarily complicated", it's in terms of
readability. I can't use these macros -- which are succinct 1 line
entries that are super easy to understand.
Pseudo code:
parse_pinctrl(np, prop_name, index)
{
if (doens't start with "pinctrl-")
return NULL;
ret = kstrtouint(propname + strlen("pinctrl"), 10, &val);
check that it's not something line "pinctrl-2nd-val" that'll still
set val to 2.
parse phandle with args and return phandle node.
}
All this when effectively 99.5% of the DT just use pinctrl-0,
pinctrl-1 and pinctrl-2. There are a few that use pinctrl-3. And
literally 6 DT files in the entire kernel source tree use pinctrl-4 or
greater.
And for those 6 files, pinctrl-[0-8] really point to the same pinctrl
node. So even if I didn't parse pinctrl-[4-8], all the device
dependencies would be tracked properly.
-Saravana
next prev parent reply other threads:[~2020-07-23 1:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 20:13 [PATCH v1 1/2] of: property: Add device link support for multiple DT bindings Saravana Kannan
2020-07-22 20:13 ` [PATCH v1 2/2] of: property: Add device link support for pinctrl-0 through pinctrl-8 Saravana Kannan
2020-07-22 20:56 ` Frank Rowand
2020-07-23 1:01 ` Saravana Kannan [this message]
2020-07-22 21:09 ` Rob Herring
2020-07-23 1:07 ` Saravana Kannan
2020-07-23 13:29 ` Rob Herring
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='CAGETcx-CajYnh=ZOkGBxrSUHe0uTAwJ_gZ8EJV1jrq-jNmaBVw@mail.gmail.com' \
--to=saravanak@google.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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).