From: Linus Walleij <linus.walleij@linaro.org>
To: Jon Hunter <jonathanh@nvidia.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2] pinctrl: Don't create a pinctrl handle if no pinctrl entries exist
Date: Sat, 18 Jun 2016 10:44:22 +0200 [thread overview]
Message-ID: <CACRpkdYvViBkjsvtPuhujpDGi6Z3CMmv8Z8-Vb_y8Xcs=XVOnw@mail.gmail.com> (raw)
In-Reply-To: <1466090861-4538-1-git-send-email-jonathanh@nvidia.com>
On Thu, Jun 16, 2016 at 5:27 PM, Jon Hunter <jonathanh@nvidia.com> wrote:
> When pinctrl_get() is called for a device, it will return a valid handle
> even if the device itself has no pinctrl state entries defined in
> device-tree. This is caused by the function pinctrl_dt_to_map() which
> will return success even if the first pinctrl state, 'pinctrl-0', is not
> found in the device-tree node for a device.
>
> According to the pinctrl device-tree binding documentation, pinctrl
> states must be numbered starting from 0 and so 'pinctrl-0' should always
> be present if a device uses pinctrl and therefore, if 'pinctrl-0' is not
> present it seems valid that we should not return a valid pinctrl handle.
>
> Fix this by returning an error code if the property 'pinctrl-0' is not
> present for a device.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Patch applied (after adding OF to the subject)
It's a bit dangerous because it changes semantics but let's see
if we survive it.
> I was wondering if this meant we are creating pinctrl handles for
> devices on boot that don't use pinctrl (when
> calling pinctrl_bind_pins()). However, although devm_pinctrl_get()
> does return successful for all devices, the subsequent call to
> pinctrl_lookup_state() (to get the default state) will fail and so
> we will destroy the pinctrl handle afterall.
It's better like this, logically. I'm just worried that there may be
code in the tree that depend on the bind always getting a handle.
Yours,
Linus Walleij
prev parent reply other threads:[~2016-06-18 8:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 15:27 [PATCH V2] pinctrl: Don't create a pinctrl handle if no pinctrl entries exist Jon Hunter
2016-06-18 8:44 ` Linus Walleij [this message]
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='CACRpkdYvViBkjsvtPuhujpDGi6Z3CMmv8Z8-Vb_y8Xcs=XVOnw@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=jonathanh@nvidia.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@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).