linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: devicetree: Keep deferring even on timeout
@ 2020-08-25 14:33 Thierry Reding
  2020-08-28 12:42 ` Linus Walleij
  2020-09-12 16:21 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Thierry Reding @ 2020-08-25 14:33 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Greg Kroah-Hartman, linux-gpio, linux-kernel, John Stultz

From: Thierry Reding <treding@nvidia.com>

driver_deferred_probe_check_state() may return -ETIMEDOUT instead of
-EPROBE_DEFER after all built-in drivers have been probed. This can
cause issues for built-in drivers that depend on resources provided by
loadable modules.

One such case happens on Tegra where I2C controllers are used during
early boot to set up the system PMIC, so the I2C driver needs to be a
built-in driver. At the same time, some instances of the I2C controller
depend on the DPAUX hardware for pinmuxing. Since the DPAUX is handled
by the display driver, which is usually not built-in, the pin control
states will not become available until after the root filesystem has
been mounted and the display driver loaded from it.

Fixes: bec6c0ecb243 ("pinctrl: Remove use of driver_deferred_probe_check_state_continue()")
Suggested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/pinctrl/devicetree.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index 5eff8c296552..3fb238714718 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -130,9 +130,8 @@ static int dt_to_map_one_config(struct pinctrl *p,
 		if (!np_pctldev || of_node_is_root(np_pctldev)) {
 			of_node_put(np_pctldev);
 			ret = driver_deferred_probe_check_state(p->dev);
-			/* keep deferring if modules are enabled unless we've timed out */
-			if (IS_ENABLED(CONFIG_MODULES) && !allow_default &&
-			    (ret == -ENODEV))
+			/* keep deferring if modules are enabled */
+			if (IS_ENABLED(CONFIG_MODULES) && !allow_default && ret < 0)
 				ret = -EPROBE_DEFER;
 			return ret;
 		}
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: devicetree: Keep deferring even on timeout
  2020-08-25 14:33 [PATCH] pinctrl: devicetree: Keep deferring even on timeout Thierry Reding
@ 2020-08-28 12:42 ` Linus Walleij
  2020-09-12 16:21 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-08-28 12:42 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Greg Kroah-Hartman, open list:GPIO SUBSYSTEM, linux-kernel, John Stultz

On Tue, Aug 25, 2020 at 4:33 PM Thierry Reding <thierry.reding@gmail.com> wrote:

> From: Thierry Reding <treding@nvidia.com>
>
> driver_deferred_probe_check_state() may return -ETIMEDOUT instead of
> -EPROBE_DEFER after all built-in drivers have been probed. This can
> cause issues for built-in drivers that depend on resources provided by
> loadable modules.
>
> One such case happens on Tegra where I2C controllers are used during
> early boot to set up the system PMIC, so the I2C driver needs to be a
> built-in driver. At the same time, some instances of the I2C controller
> depend on the DPAUX hardware for pinmuxing. Since the DPAUX is handled
> by the display driver, which is usually not built-in, the pin control
> states will not become available until after the root filesystem has
> been mounted and the display driver loaded from it.
>
> Fixes: bec6c0ecb243 ("pinctrl: Remove use of driver_deferred_probe_check_state_continue()")
> Suggested-by: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Just like with the identical patch from John I got a while back, I'd like
some nod from the device core maintainers (Greg or Raphael) that this
is how we want to do things.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: devicetree: Keep deferring even on timeout
  2020-08-25 14:33 [PATCH] pinctrl: devicetree: Keep deferring even on timeout Thierry Reding
  2020-08-28 12:42 ` Linus Walleij
@ 2020-09-12 16:21 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-09-12 16:21 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Greg Kroah-Hartman, open list:GPIO SUBSYSTEM, linux-kernel, John Stultz

On Tue, Aug 25, 2020 at 4:33 PM Thierry Reding <thierry.reding@gmail.com> wrote:

> From: Thierry Reding <treding@nvidia.com>
>
> driver_deferred_probe_check_state() may return -ETIMEDOUT instead of
> -EPROBE_DEFER after all built-in drivers have been probed. This can
> cause issues for built-in drivers that depend on resources provided by
> loadable modules.
>
> One such case happens on Tegra where I2C controllers are used during
> early boot to set up the system PMIC, so the I2C driver needs to be a
> built-in driver. At the same time, some instances of the I2C controller
> depend on the DPAUX hardware for pinmuxing. Since the DPAUX is handled
> by the display driver, which is usually not built-in, the pin control
> states will not become available until after the root filesystem has
> been mounted and the display driver loaded from it.
>
> Fixes: bec6c0ecb243 ("pinctrl: Remove use of driver_deferred_probe_check_state_continue()")
> Suggested-by: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

I applied this patch (rather than Johns') since John agreed this
is a better solution.

I got Greg's ACK on Johns patch but not this one, but anyways
it shows he's convenient with the concept so here we go.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-12 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 14:33 [PATCH] pinctrl: devicetree: Keep deferring even on timeout Thierry Reding
2020-08-28 12:42 ` Linus Walleij
2020-09-12 16:21 ` Linus Walleij

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).