Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1658892
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Johan Hovold <johan@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 4/7] driver core: fix automatic pinctrl management |
| Date | Tue, 06 Jun 2017 18:10:01 +0200 |
| Message-ID | <tPpdn-2Df-13@gated-at.bofh.it> (permalink) |
| References | <tPpdn-2Df-5@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=l0sxWPxMQsEKMRa2e7vbQQAxBQTTCXESMi4a2vNeTVg=; b=BT1v/8HOSEZSRByoD2g+nioy3kUZd67BRMKruzgP3q1FFnPAhqS8Fpic3wyQZLyQ+X uADy3eCFac/3qDpImOEtfRH65v/dIYlZcdXCI5zV74xWXkhCMZrbTJYNeOCm8yoh59IN 1PukxFbQPCjEoRzIiTDfzxI5Fm1D43UaGUzx7at2XQgCCgzbtFxH1hDiE89ZW0GV7xTT wzYO7xy8wYw6zQI2i7F/fhWIEFaCfyAutNSoTP5EhSR67bxR45L0e8OFywn57tHWlfyZ v4PVIjgSNhVVPEOPnixcKcLfHL8vyeQot0GuXEhG3uTHRjddyav+NBk8CEOrN/MNdlnp YZ5g== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=l0sxWPxMQsEKMRa2e7vbQQAxBQTTCXESMi4a2vNeTVg=; b=JLagsOOvvED2Y8/C/iPw1K4vDCPDDwRoyXnleMfojYp3g7bOQimIhEQFqp+HCLXdf0 lFlKNNFRMSZLmKAI95WoSmyiTQeqoLoY6hGnTFte2oKnbl6VJZC6PL0MROa2dPjMPF+c K569/wkZ7yEiH3+F67W8nbQ9Jco6M2PcCWZRm+rTGV8RmEakY9XsRIdLhcy1nbDiVMmP +W414eon/aHjOWRZ73Z6C6HsbO3qptQFmBZK/q8TPZ1suNtNWjIrzAr3fCKRLWUwLVa6 S/BJSvWy3+pcyd8ovGhQ/sQ0ZZuF87i0MSKNJhSMLkjKsFpWwHb5kwjKiEk4vUxur4By v3Jw== |
| X-Gm-Message-State | AODbwcCydzDL+HgBLiudyZ06UJF+vHO80l+Vt8FLwkNPq7zxf6pPBBEm ayMZeH9BVeXSUw== |
| X-Received | by 10.25.227.15 with SMTP id a15mr7933750lfh.22.1496764848290; Tue, 06 Jun 2017 09:00:48 -0700 (PDT) |
| X-Mailer | git-send-email 2.13.0 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 50 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Linus Walleij <linus.walleij@linaro.org>, Peter Chen <peter.chen@nxp.com>, Rob Herring <robh@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Sricharan R <sricharan@codeaurora.org>, Zhang Rui <rui.zhang@intel.com>, Eduardo Valentin <edubezval@gmail.com>, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, Johan Hovold <johan@kernel.org> |
| X-Original-Date | Tue, 6 Jun 2017 17:59:01 +0200 |
| X-Original-Message-ID | <20170606155904.26819-5-johan@kernel.org> |
| X-Original-References | <20170606155904.26819-1-johan@kernel.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1658892 |
Show key headers only | View raw
Commit ab78029ecc34 ("drivers/pinctrl: grab default handles from device
core") added automatic pin-control management to driver core by looking
up and setting any default pinctrl state found in device tree while a
device is being probed.
This obviously runs into problems as soon as device-tree nodes are
reused for child devices which are later also probed as pins would
already have been claimed by the ancestor device.
For example if a USB host controller claims a pin, its root hub would
consequently fail to probe when its device-tree node is set to the node
of the controller:
pinctrl-single 48002030.pinmux: pin PIN204 already requested by 48064800.ehci; cannot claim for usb1
pinctrl-single 48002030.pinmux: pin-204 (usb1) status -22
pinctrl-single 48002030.pinmux: could not request pin 204 (PIN204) from group usb_dbg_pins on device pinctrl-single
usb usb1: Error applying setting, reverse things back
usb: probe of usb1 failed with error -22
Fix this by checking the new of_node_reused flag and skipping automatic
pinctrl configuration during probe if set.
Note that the flag is checked in driver core rather than in pinctrl
(e.g. in pinctrl_dt_to_map()) which would specifically have prevented
intentional use of a parent's pinctrl properties by a child device
(should such a need ever arise).
Fixes: ab78029ecc34 ("drivers/pinctrl: grab default handles from device core")
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/base/pinctrl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/pinctrl.c b/drivers/base/pinctrl.c
index 5917b4b5fb99..eb929dd6ef1e 100644
--- a/drivers/base/pinctrl.c
+++ b/drivers/base/pinctrl.c
@@ -23,6 +23,9 @@ int pinctrl_bind_pins(struct device *dev)
{
int ret;
+ if (dev->of_node_reused)
+ return 0;
+
dev->pins = devm_kzalloc(dev, sizeof(*(dev->pins)), GFP_KERNEL);
if (!dev->pins)
return -ENOMEM;
--
2.13.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v2 4/7] driver core: fix automatic pinctrl management Johan Hovold <johan@kernel.org> - 2017-06-06 18:10 +0200
csiph-web