From: Stephen Warren <swarren@wwwdotorg.org>
To: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Kevin Hilman <khilman@ti.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Russell King <linux@arm.linux.org.uk>,
Benoit Cousson <b-cousson@ti.com>,
Linus Walleij <linus.walleij@linaro.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Felipe Balbi <balbi@ti.com>,
Rickard Andersson <rickard.andersson@stericsson.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Mitch Bradley <wmb@firmworks.com>,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
linux-next@vger.kernel.org
Subject: Re: [PATCH v2] drivers/pinctrl: grab default handles from device core
Date: Thu, 10 Jan 2013 15:07:43 -0700 [thread overview]
Message-ID: <50EF3BAF.4010200@wwwdotorg.org> (raw)
In-Reply-To: <50EF27B4.60608@wwwdotorg.org>
On 01/10/2013 01:42 PM, Stephen Warren wrote:
> On 12/12/2012 01:25 PM, Linus Walleij wrote:
>> From: Linus Walleij <linus.walleij@linaro.org>
>>
>> This makes the device core auto-grab the pinctrl handle and set
>> the "default" (PINCTRL_STATE_DEFAULT) state for every device
>> that is present in the device model right before probe. This will
>> account for the lion's share of embedded silicon devcies.
>
> There are quite a few problems with this patch, and they end up
> completely breaking at least Tegra in next-20130110.
>
>> diff --git a/drivers/base/pinctrl.c b/drivers/base/pinctrl.c
>
>> +int pinctrl_bind_pins(struct device *dev)
>> +{
>> + struct dev_pin_info *dpi;
>> + int ret;
>> +
>> + /* Allocate a pin state container on-the-fly */
>> + if (!dev->pins) {
>> + dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL);
>> + if (!dpi)
>> + return -ENOMEM;
>> + } else
>> + dpi = dev->pins;
>> +
>> + /*
>> + * Check if we already have a pinctrl handle, as we may arrive here
>> + * after a deferral in the state selection below
>> + */
>> + if (!dpi->p) {
>> + dpi->p = devm_pinctrl_get(dev);
>
> That won't succeed for a pinctrl device that has a default state in
> order to implement hogs. This will then cause the pin controller device
> to always defer probe and never activate. This will leave HW
> unconfigured and/or prevent other devices from successfully calling
> pinctrl_get().
I see that an attempt was made to solve this problem, in the patch
immediately preceding this one (at least, as applied in the pinctrl
tree). However, that patch only addresses the case where the pin
controller is being looked up in the map, and not the case when
converting device tree to the map in the first place. The patch below
solves this:
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index fe2d1af..fd40a11 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -141,6 +141,11 @@ static int dt_to_map_one_config(struct pinctrl *p,
const char *statename,
pctldev = find_pinctrl_by_of_node(np_pctldev);
if (pctldev)
break;
+ /* Do not defer probing of hogs (circular loop) */
+ if (np_pctldev == p->dev->of_node) {
+ of_node_put(np_pctldev);
+ return -ENODEV;
+ }
}
of_node_put(np_pctldev);
next prev parent reply other threads:[~2013-01-10 22:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1355343907-11535-1-git-send-email-linus.walleij@stericsson.com>
2013-01-10 20:42 ` [PATCH v2] drivers/pinctrl: grab default handles from device core Stephen Warren
2013-01-10 22:07 ` Stephen Warren [this message]
2013-01-11 20:22 ` Linus Walleij
2013-01-11 20:12 ` Linus Walleij
2013-01-11 20:36 ` Laurent Pinchart
2013-01-11 20:45 ` Linus Walleij
2013-01-16 17:49 ` Stephen Warren
2013-01-17 0:59 ` Linus Walleij
2013-01-17 2:33 ` Greg KH
2013-01-17 16:30 ` Stephen Warren
2013-01-17 6:02 ` Simon Horman
2013-01-17 16:31 ` Stephen Warren
2013-01-17 23:55 ` Simon Horman
2013-01-18 15:05 ` Linus Walleij
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=50EF3BAF.4010200@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=b-cousson@ti.com \
--cc=balbi@ti.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@ti.com \
--cc=linus.walleij@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=plagnioj@jcrosoft.com \
--cc=rickard.andersson@stericsson.com \
--cc=rjw@sisk.pl \
--cc=thomas.petazzoni@free-electrons.com \
--cc=ulf.hansson@linaro.org \
--cc=wmb@firmworks.com \
/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).