Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1508700pxa; Fri, 28 Aug 2020 14:51:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKzPMbWHA1wTUdNW/C9Y3PVbgDICStqaOHnFEea8jUGVv0LSQ+pCw96+/FU3yVZeTKMw4N X-Received: by 2002:a50:ba8c:: with SMTP id x12mr797118ede.319.1598651465675; Fri, 28 Aug 2020 14:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598651465; cv=none; d=google.com; s=arc-20160816; b=C4FhasInpyvkC82RgLi42tfQuaZP02y+Puj/GKC3QLXsv2Q5GADlwZEyipm2a4A1N0 dt6WjFk7iHeVgw7+nkSUN4Nqo7Z5khQ8Y3g1Ldtd3ZwuRVAmfajZ6UDBrYYVycWvgaVa y8CCOpj4LwX3t87WTYdEO1VKP/favRqDNzLwgeOteq3neRUlAp2bhccfZBylMEkZPgYE yRTwoQPoM9BJSRAlTf7Y/nUsGQJinGPcLIQwI4TMc+nsRSnkc5WkU6vwApV6nD38w3XC v4xWsQ8evAlAg2NnJkGFAztMvqqIXQE97jjxAJ1B/A+N4Zk8D+UDgCKCnV4iMUrQz+OF fyIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=O1rtOVVZTmOiLPUX5y+uamzdccZJCnIu4DK04RrHtrw=; b=ned+kw6ay2Snrx0W8ptxQVsKdEmzx6d3l6wyE/FRHutH/oxAOokp8gEqMyPQKGnMUo 6UdSJH2QLfAOWbK4/GiStjwq+Yv8W7o0OP3laW6JICLm1TW1KrHiFzEe/pG3VMsFMSVy gA1Jk9/ZmHOhuQ2GYdwXgc7mqmt+edU4ZsgMyvl8zUEKyb96g4hPxJBYfu92g7B+Eg3R butM9j7zCvwKdsWRLiKrOk2UPIb3ydMI0wcc/YdZc5UHIRseWdKHszEPungDwJKIQka4 nAOhOrAsCXSuCFgo6D1R3ndSCA/byldr2Py5pCMJYor31xDdGDKf2uk+piEpmfEgQTJi s6eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VqvDd/7J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si250355edm.382.2020.08.28.14.50.38; Fri, 28 Aug 2020 14:51:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VqvDd/7J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726594AbgH1Vrn (ORCPT + 99 others); Fri, 28 Aug 2020 17:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbgH1Vrn (ORCPT ); Fri, 28 Aug 2020 17:47:43 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15F34C06121B for ; Fri, 28 Aug 2020 14:47:42 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id 109so500709otv.3 for ; Fri, 28 Aug 2020 14:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O1rtOVVZTmOiLPUX5y+uamzdccZJCnIu4DK04RrHtrw=; b=VqvDd/7JFJoefDnYMDd2TnyWSeNLC0c+tjwlXhfGi7Vr5XBCIXjWeQTN7ktw/f3JlW L8n0EnP4ai7P5w/pGbf0OKl8qGyXDV/uccgr+DtB9WD3906b4faaiDn/QMmRuoSgjyJ2 nnhMkrwUTxKGnhf40Ppjk8Bwb4Nwkdt2Hh30lRCdCiGiVLUpAtML9UfNsMuyOHLqKtJV Jy8FhnvcJzxu85ibASKpleexf/WWmDegSfu1FQzzE3PUze7xY1wHbGjPYFfVLejZWH0L WdqzUFhQNBf6+c6LclO8fnlu6ORYB3+dPyavBA5FkK5cwYvKxeXKNfdpw1EDfvcKB3oM 6Oxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O1rtOVVZTmOiLPUX5y+uamzdccZJCnIu4DK04RrHtrw=; b=bjBx+N2ROT8oK5d7RbYUeMtWUsps9hKp2qICdOtofNirHb4g69izC3iUECAp7plC7y SBHx7aYHP/Ft77DHdBdREXr2SpdPH3kVxOtIcrxfMr0UBswpX9mGVsvt/WpJHqzliNn9 MpBYs2lbeTf8c4SXxXssesMy34L/V2aHfM9jpC447lbyCZiZo58hlBKD5D1itpVfsdYK ZikF0Nt1RwAWrebfZhSwWuX0owqNSoD50Fk9RpRC2cshyxkMpA15lX3ODhVVyJrHyziu rdICbH5fFeum35eOzwy8IYOyGxTU4y24obxaYAHwxR56TkEvDqZhxyF2B3PLJLItkH/U 8+iw== X-Gm-Message-State: AOAM533HAj513Au22Sk1bCL40pDwSPCo2A6L23oAkhjnD8S/8VT5Fyox /islV2kDVWLYmWk9uxxjeIk8D37PUAR9X4vE968Kwg== X-Received: by 2002:a9d:7846:: with SMTP id c6mr452529otm.221.1598651260423; Fri, 28 Aug 2020 14:47:40 -0700 (PDT) MIME-Version: 1.0 References: <20200808043512.106865-1-john.stultz@linaro.org> <20200828120154.GA1674264@ulmo> In-Reply-To: <20200828120154.GA1674264@ulmo> From: John Stultz Date: Fri, 28 Aug 2020 14:47:27 -0700 Message-ID: Subject: Re: [RFC][PATCH] pinctrl: Rework driver_deferred_probe_check_state() evaluation since default timeout has changed To: Thierry Reding Cc: lkml , Linux PM list , Greg Kroah-Hartman , Linus Walleij , Mark Brown , Liam Girdwood , Bjorn Andersson , Saravana Kannan , Todd Kjos , Len Brown , Pavel Machek , Ulf Hansson , Kevin Hilman , "Rafael J. Wysocki" , Rob Herring Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 5:02 AM Thierry Reding wrote: > > On Sat, Aug 08, 2020 at 04:35:12AM +0000, John Stultz wrote: > > In commit bec6c0ecb243 ("pinctrl: Remove use of > > driver_deferred_probe_check_state_continue()"), we removed the > > use of driver_deferred_probe_check_state_continue() which > > effectively never returned -ETIMED_OUT, with the > > driver_deferred_probe_check_state() function that had been > > reworked to properly return ETIMED_OUT when the deferred probe > > timeout expired. Along with that change, we set the default > > timeout to 30 seconds. > > > > However, since moving the timeout to 30 seconds caused some > > issues for some users with optional dt links, we set the > > default timeout back to zero - see commit ce68929f07de ("driver > > core: Revert default driver_deferred_probe_timeout value to 0") > > > > This in essence changed the behavior of the pinctrl's usage > > of driver_deferred_probe_check_state(), as it now would return > > ETIMED_OUT by default. Thierry reported this caused problems with > > resume on tegra platforms. > > > > Thus this patch tweaks the pinctrl logic so that it behaves as > > before. If modules are enabled, we'll only return EPROBE_DEFERRED > > while we're missing drivers linked in the DT. > > > > Cc: linux-pm@vger.kernel.org > > Cc: Greg Kroah-Hartman > > Cc: Linus Walleij > > Cc: Thierry Reding > > Cc: Mark Brown > > Cc: Liam Girdwood > > Cc: Bjorn Andersson > > Cc: Saravana Kannan > > Cc: Todd Kjos > > Cc: Len Brown > > Cc: Pavel Machek > > Cc: Ulf Hansson > > Cc: Kevin Hilman > > Cc: "Rafael J. Wysocki" > > Cc: Rob Herring > > Fixes: bec6c0ecb243 ("pinctrl: Remove use of driver_deferred_probe_check_state_continue()") > > Fixes: ce68929f07de ("driver core: Revert default driver_deferred_probe_timeout value to 0") > > Reported-by: Thierry Reding > > Signed-off-by: John Stultz > > --- > > 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 c6fe7d64c913..09ddf567ccb4 100644 > > --- a/drivers/pinctrl/devicetree.c > > +++ b/drivers/pinctrl/devicetree.c > > @@ -129,9 +129,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 = -EPROBE_DEFER; > > return ret; > > } > > I posted almost exactly the same patch a couple of days ago since I > hadn't noticed this: > > https://patchwork.ozlabs.org/project/linux-gpio/patch/20200825143348.1358679-1-thierry.reding@gmail.com/ > > I like that slightly better because it keeps the "ret < 0" condition, > which I think is perhaps a bit more future-proof. Thinking about it, I'm > not sure your version above is entirely correct. For example if the call > to driver_deferred_probe_check_state() were to ever return 0, we might > still be returning -EPROBE_DEFER here. Yea. I agree that your patch is preferred. > That's not something that happens currently, but I suspect that these > implications will be easy to overlook. > > Actually... I think it might be best to just bring back (albeit perhaps > in a modified form) driver_deferred_probe_check_state_continue() because > we're now basically doing exactly what that was supposed to do: special- > casing the case where we do want to continue returning -EPROBE_DEFER in > some special cases. Is it likely that the special case situation is common? It seems having the driver do the special casing in its code (even better, with an explanation for why that driver needs it) will be better then having multiple similar hooks that don't have clear explanations that drivers are likely to mix up. thanks -john