[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGETcx-CajYnh=ZOkGBxrSUHe0uTAwJ_gZ8EJV1jrq-jNmaBVw@mail.gmail.com>
Date: Wed, 22 Jul 2020 18:01:57 -0700
From: Saravana Kannan <saravanak@...gle.com>
To: Frank Rowand <frowand.list@...il.com>
Cc: Rob Herring <robh+dt@...nel.org>,
Android Kernel Team <kernel-team@...roid.com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 2/2] of: property: Add device link support for
pinctrl-0 through pinctrl-8
On Wed, Jul 22, 2020 at 1:56 PM Frank Rowand <frowand.list@...il.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
Powered by blists - more mailing lists