From patchwork Thu Feb 20 05:04:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183651 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp140907ile; Wed, 19 Feb 2020 21:05:00 -0800 (PST) X-Received: by 2002:a63:2e42:: with SMTP id u63mr30583846pgu.137.1582175099818; Wed, 19 Feb 2020 21:04:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582175099; cv=none; d=google.com; s=arc-20160816; b=idTGLtAv1qJYKzNZqEMiYw9XSlIiibb/1fnjPQZqrzxm/5PQQB4UrrKXePIxm+f9JX JhXGz3wDHJTRDgYq7Jxt69x03kUcC0DMWaGXdI9EJAWUegcRZnWLNIRzjHE6cgZ69+5A uaRGw2z1tQzEiNSgyJro90cBRkOaDreTkOg9eNRWG6+NtCxUA40M7m4fl3XDg6Dll73w FFCwiVO3Qo/kGLGSryprRNFOX+1Or43BUXVGihOqVxbjYKDqjNk1imBmTzXZT39T2e8h pBOKmtUe9jKwF7eze3TrIioYdzwOfYugUNhX7HcHwrKdVY2RoudDISi24COS6QHT8QLZ co2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/T58NGHopB3l5IaHe5dr2sMuh4DNsWpX5Bm1fmPX41g=; b=i38VtQYlKQs16PsNyVMMbZSjfbbUu2QYhdw6OCAZYBm4tQEN27TtShG9mFZdUGx1l7 L65MIctdn0nCC6Kkaqljl86vhP8G6bzPfMWRaI3mzBz8S2syjOrK1yqswmyhYe9v39qt IInU+Z7Y9sv2KwFxQK0dm7d97lwb86mrxaYchD/LHk0+Xclst5U/BQDoCF+6X/LpoxYO YrDuckfMKnGyct9rqGy/mRaMBdvt6uV7HGMkRs29gjfTNsb46H0tt3wrknDqLkgcl5CW JhBmLOzPiS8FcCvxRJOLMfk5kv5xlffxaPUU8r7PqZUjhMrrl4r9pYD3Bzf59oH2BndM xs3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S2OqtMi4; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u12sor2200898plm.62.2020.02.19.21.04.59 for (Google Transport Security); Wed, 19 Feb 2020 21:04:59 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S2OqtMi4; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/T58NGHopB3l5IaHe5dr2sMuh4DNsWpX5Bm1fmPX41g=; b=S2OqtMi4d7N85eKmqs1n60PvHhJ3iczKNhZd3H4xFKxZrquUWEjkKNOYhKwBBrq/yK +eOA9gZ5h1AMNe5U3gT3ELiZIEh5UG8Pfe1ACDe0dWSLrLzkN9t9IWgWyou0SwbC2YDT DtjeAbTk1XwtwSzd9qqZQhHoXaF/RykNvfqrqFM67BpFMRdjPowh1ijaNpcSZEfzOzj2 MJMNg9nJeeq8g+SPs/wEbrtaJXAuLPRczDvjJacgR8ntcZMI9FOqASEU/2DQr+R/U8Ma P+aTOaOUMgky6Uwxjg/SYPT5W9wlt5RcVA+iNFMdQQw7VydaYEDcOTX63cWT0I+rgX4P e8PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/T58NGHopB3l5IaHe5dr2sMuh4DNsWpX5Bm1fmPX41g=; b=lR5QStI5vbZTKsh92DO2ROGCM9OMs+Fas/sSZfapZ4LpS5LojERAzvQ6nc8hJRrviR ALrQWORtK7X7g3rGk2inggwg5ZorHL9pEB4t1AF4guApAtKYddJH9EnNHiTez8u5Dq7d 3xcE0bm8+9d+A7iNs6jLFJXlz9KTj6C6O9u8JbNZ+M7dwI2JRJoXX18ktXQ0vvsDhAMA RhHuJnonA7sLIUibfVOPlI+DVk25J1Aa4/lDaMr/oZX21sEvEuYqGVBdDKGmI4u/84fg veOOdz7nlXLyNnAk1ER4CaseTwV7xMtUMYX2ZihJwFD1xJ2IDfDJPY7rkMyKd2yTDWlR dY8w== X-Gm-Message-State: APjAAAXFCVDJVaOdKRIEy9yhWdzKNNxpbNoN5xyIo/o8G/M7HYRYdlga RbhXA6BWTDNXufMJYBQJX7GBWsil X-Google-Smtp-Source: APXvYqx7blf57WRdqHC+FiTTfSehSN8U0lLCPg8GgWjsosKUg28yXPBGYhNTcpJXcdEWuI0YfQrQnA== X-Received: by 2002:a17:902:820b:: with SMTP id x11mr29388518pln.196.1582175099414; Wed, 19 Feb 2020 21:04:59 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:04:58 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 1/6] driver core: Fix driver_deferred_probe_check_state() logic Date: Thu, 20 Feb 2020 05:04:35 +0000 Message-Id: <20200220050440.45878-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> driver_deferred_probe_check_state() has some uninituitive behavior. * From boot to late_initcall, it returns -EPROBE_DEFER * From late_initcall to the deferred_probe_timeout (if set) it returns -ENODEV * If the deferred_probe_timeout it set, after it fires, it returns -ETIMEDOUT This is a bit confusing, as its useful to have the function return -EPROBE_DEFER while the timeout is still running. This behavior has resulted in the somwhat duplicative driver_deferred_probe_check_state_continue() function being added. Thus this patch tries to improve the logic, so that it behaves as such: * If deferred_probe_timeout is set, it returns -EPROBE_DEFER until the timeout, afterwhich it returns -ETIMEDOUT. * If deferred_probe_timeout is not set (-1), it returns -EPROBE_DEFER until late_initcall, after which it returns This will make the deferred_probe_timeout value much more functional, and will allow us to consolidate the driver_deferred_probe_check_state() and driver_deferred_probe_check_state_continue() logic in a later patch. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz Change-Id: I8349b7a403ce8cbce485ea0a0a5512fddffb635c --- v4: * Simplified logic suggested by Andy Shevchenko * Clarified commit message to focus on logic change --- drivers/base/dd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index b25bcab2a26b..bb383dca39c1 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -237,7 +237,7 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); static int __driver_deferred_probe_check_state(struct device *dev) { - if (!initcalls_done) + if (!initcalls_done || deferred_probe_timeout > 0) return -EPROBE_DEFER; if (!deferred_probe_timeout) { @@ -252,9 +252,11 @@ static int __driver_deferred_probe_check_state(struct device *dev) * driver_deferred_probe_check_state() - Check deferred probe state * @dev: device to check * - * Returns -ENODEV if init is done and all built-in drivers have had a chance - * to probe (i.e. initcalls are done), -ETIMEDOUT if deferred probe debug - * timeout has expired, or -EPROBE_DEFER if none of those conditions are met. + * Returnes -EPROBE_DEFER if initcalls have not completed, or the deferred + * probe timeout is set, but not expried. + * Returns -ETIMEDOUT if the probe timeout was set and has expired. + * Returns -ENODEV if initcalls have completed and the deferred probe timeout + * was not set. * * Drivers or subsystems can opt-in to calling this function instead of directly * returning -EPROBE_DEFER. From patchwork Thu Feb 20 05:04:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183652 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp140932ile; Wed, 19 Feb 2020 21:05:02 -0800 (PST) X-Received: by 2002:a63:4281:: with SMTP id p123mr30838972pga.371.1582175101991; Wed, 19 Feb 2020 21:05:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582175101; cv=none; d=google.com; s=arc-20160816; b=dK6ltudj8Wb47x1Bi4vrppR7aFFbiKsfrHZ5/QWF7ljY/ofHVTkx3QYsFPlWo86sYf 8hGeDW+tp+5HyQtuYmtzG/J+biVEeSqjfHVUm9NpezRlMRyB0YUaBxobguMfsAbAOK8V pZcRiSefKZzyGmATX44yLNCFzmFiKUT8DhAk+VyBtuWjGatTXLSAcW+ewMlBZmfldZ40 VTqXkAKxP/7JqumWKLhm1LpcrOAHQX7IcDiT8PKi4a2DH9AuH26t3VfXnTUIRIDGQiyC fmTXh4e92/RR3OwmBYcGUvJg/QSFOZ8w1pRKzeQ/BFzgbQU335bbBUcfGVgvMAs1nFQg C12w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dyNzXT8jLD/h3SHy8a6cXUYQMkAeXAKSKv5N+Mj3VNM=; b=da1kvPDcwFfcoz0m2dOD01/1MUOHoaE+YfMOLL8EgfOzWR850GxvawvCAzmuIs3zCn rieRF8ympV7DH+KAXRY8JJrr78Ysu4DDux+UVXnPtocNBOQ88pIV/QRHwUP/MQgBTR6W 75HuIhrdHgWQ/8HIpiarCqf72551DO0LwZZU4+ROWmdZ9pzdhJ4bqwewCcNrTgdzJqt2 bU2aZ4D9szUerd/2NZoa3pd6y7EttNVTZu1Fqo2sN+28SjxGpT7f9nLouX04Z/5j6Jnr dlvyGN+dQqMmVVM2+BwqaxhnObjn7Y19zP9bXLsaNJIS8B4gaMODhFSO34ybokj8XjZg YAsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qDZfr9MC; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m15sor2040330pgh.36.2020.02.19.21.05.01 for (Google Transport Security); Wed, 19 Feb 2020 21:05:01 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qDZfr9MC; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dyNzXT8jLD/h3SHy8a6cXUYQMkAeXAKSKv5N+Mj3VNM=; b=qDZfr9MCt0H7vO2O2iGnZXpDtP5E3Qw9y7loJoWPu3Sj//W9D1V3bwpfmBtms4Xo0c y6yfy3huIAtnE5UxWFpK65fS4DIrSHQFpLXMYKAj6NImy/HuUzvlH38b2SN336GjLW2P +grV3nLOxp0DzcR0vqK1R92Ly+imwIohlL8Xpci5eFMJR0vPC9Q4YNZtns4C3XB1J/rT iLYeXLknGxrnrOsXDUQuWLZ6vXxoXWbxjjXuLwZgC+dT9w/QcUb+OAsmwh1RW+9SLOgc 82NKg5tXDHCXkDfMmQbjifdqPgWa6yDzv1kwkFqvuVL6iPJ7/9X4UGYmWTylJYSBgUJG DTGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dyNzXT8jLD/h3SHy8a6cXUYQMkAeXAKSKv5N+Mj3VNM=; b=f2QFLGq+KGgh+/IGp7AusaTKMm6jh0cdeNaBNlY4vNObKD5Fm83/ytslAj0omiGxKR uyh1KzmGj3qQM9IQFrPWmwB3wv8fWpEUZ/ggymC24CblTQZOv4ttz3ikRw8iLuOWsAzQ bqWLj2a1sZZTaJFsD79+YgofOFEvPAwAgXt9zwkhv+g7Fy6VFmrKmunqDyfpLU7XzzlG AWh/47XMJ+BBoqWuBlOnjxjFORd8eVkpoYt/PCl4RvYtx8jQ9TrmRV/5IoO1pMzOzxXV s+2ertv8b5a9xb2jogEvKObitY133NU3xyKfxHxOpYBwirNDEzoryspGPbaqxg1pyOPF Ry8Q== X-Gm-Message-State: APjAAAUduBrz8O02fXC9UK+YScTu4GtCSE5T23uU1gY9OfObA5/NIGpf 2n82PQOSKJS9Y8MBCnuIB6A01Wpb X-Google-Smtp-Source: APXvYqwKxpJ3up3gMovM7cilewhjBB7h6jVLv5FEJQ5jkpiNN8ZLL6nciC7CXK+kdMoSse7byXh8eg== X-Received: by 2002:a63:ec07:: with SMTP id j7mr30998730pgh.187.1582175101605; Wed, 19 Feb 2020 21:05:01 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:01 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 2/6] driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set Date: Thu, 20 Feb 2020 05:04:36 +0000 Message-Id: <20200220050440.45878-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> When using modules, its common for the modules not to be loaded until quite late by userland. With the current code, driver_deferred_probe_check_state() will stop returning EPROBE_DEFER after late_initcall, which can cause module dependency resolution to fail after that. So allow a longer window of 30 seconds (picked somewhat arbitrarily, but influenced by the similar regulator core timeout value) in the case where modules are enabled. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz Change-Id: I9c5a02a54915ff53f9f14d49c601f41d7105e05e --- v4: * Split out into its own patch as suggested by Mark * Made change conditional on CONFIG_MODULES --- drivers/base/dd.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index bb383dca39c1..fa138f24e2d3 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -224,7 +224,16 @@ static int deferred_devs_show(struct seq_file *s, void *data) } DEFINE_SHOW_ATTRIBUTE(deferred_devs); +#ifdef CONFIG_MODULES +/* + * In the case of modules, set the default probe timeout to + * 30 seconds to give userland some time to load needed modules + */ +static int deferred_probe_timeout = 30; +#else +/* In the case of !modules, no probe timeout needed */ static int deferred_probe_timeout = -1; +#endif static int __init deferred_probe_timeout_setup(char *str) { int timeout; From patchwork Thu Feb 20 05:04:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183653 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp140978ile; Wed, 19 Feb 2020 21:05:05 -0800 (PST) X-Received: by 2002:a17:90a:c592:: with SMTP id l18mr1423733pjt.105.1582175105269; Wed, 19 Feb 2020 21:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582175105; cv=none; d=google.com; s=arc-20160816; b=ZGOVLCPb/0T0jgpB/GzUnefBWbKC7Ap8Ain9SLKxusyPpuT9pfv2owawHZZxsM5hpb jRDqYjO3qKO9kw+nUqIT/MUc4EsaXxXOrdUzEp/9CZ0mZPGG1ZwqJi59Vm4b/SbtTyOA emdfaeq9tu1HP1PyFkdaRmUKQVSD6rsS6vaqM2bnHbH5Fp47tdl4GIcJUdOklBFe4qcH 11cS08xQ6seLDJmeX+Zrifg6kFM+uifpttLKmWzlK8NAqbq50wrIpZKQi6gSS7f5WQRT ASchUCKgdq8++I2Ck/KXH+44hgUNXwF0aYQxSaXgqjl9ACmQi+SqwohEsXjs7NHFEvXw 4XRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wOHv+QxDznql2h/B9QPBonJ8+Ax46oQhAeGgxF/JNeY=; b=IiJ0O9qzHF0oAC2T9UP/u+H0OuW4cfetKspSOhU2Zk2+v61fwqtkjYqcRhxAKSFaD/ cOjR0CJ+7C+LntR0plxTAsr1aUtghV9fhPTnl4Oyufy1ONv8aAG0aLB8HG6/UaZ0nhVu esNGFQS7ekRG45dGBnlTADZYJFwytqyff5HSmBmLYU8wXbzn3GllZu697HyEe821yxHl QbDI/iLGXWmcKPH1AHHIZiOilHEArPnbPijyaiXdl6XeKTBqaJa2gqGOjl665LZBLZ2d nXpx/1Miis7dEeUdwGK41BzhL1HlWdhg7AxI2ROKiTrsgrCAE4RwMInaS6sXcEACjF9u 7d3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LH5XyaX9; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w62sor1957068pfc.68.2020.02.19.21.05.05 for (Google Transport Security); Wed, 19 Feb 2020 21:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LH5XyaX9; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wOHv+QxDznql2h/B9QPBonJ8+Ax46oQhAeGgxF/JNeY=; b=LH5XyaX9GkiXyqpCmh8o/RmVlUzm/wMIM4fbcM8puY7zZs3tkeCMoWyQvz1qRH9rB4 i+GNjONvTcEEgSua8Qg0qqz+ExgOjFXX0Zz280K+I6tcAeU2WJazEtGW2fESRdpvRMo0 SJquQgprFLgJJuJkbwYI06B7EzImZphVYtWdVcjSnGXh0xGPCyrnYzrOGJmYtS507qjq nmlxqkwq6rJCyydRmqB3PaFDprIyfqwvuK+REsrevHVvba+3784IwzSHng/r1IMUu+CH 8CRYOzTUlXmR8o9JOtoGocZDJEzk5+a7ipJP43AYUpOJlHCLgVBmw4ibGtoGvcMIsAjV peUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wOHv+QxDznql2h/B9QPBonJ8+Ax46oQhAeGgxF/JNeY=; b=Gp6gv/9nkAyLSFKLIqlCS1zLiGhGd8T2mhYSwgbqcQfIz8PMQUbPH8HSoz37FZUw+Y fjuXTozWpUoyL0z+xX+Fs2MqnkUCEO1WYIrVJ0anBDHv22ll0VR7izT1S+ww6acTK0vA bzqczrVyUaa1qLJFih1TAToy+6c6QFutSipfGX7bIiuRuNB/+70ac57vDXjTm8jzR/Qo zWEuT35LmEIIPuVnAla3SW6d00R1jUVlsLgujMwvBszINhTm359rfw/m1fKPjrEoG9ff m5ds6vAm0aREx+eGy274MYOqjL0w0VgS/Ct2FzPeubQcNjnbDckCkGpTno9HQHNQZeEd GP+A== X-Gm-Message-State: APjAAAVzxZeZmFwP762FP+0+EdYhZ4KYShvbo7GVjc0jxK711BVd6UAh bxIxSHfEzMu59A8H+rd35td/rrek X-Google-Smtp-Source: APXvYqzDQ6HAmjnhvjQifECUMimuCSlgupkPtgBhcHq5XHZ8TdmewbwVVAsZffG/RJMKQi2upxnz0A== X-Received: by 2002:aa7:9aa5:: with SMTP id x5mr30831744pfi.131.1582175104812; Wed, 19 Feb 2020 21:05:04 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:04 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 3/6] pinctrl: Remove use of driver_deferred_probe_check_state_continue() Date: Thu, 20 Feb 2020 05:04:37 +0000 Message-Id: <20200220050440.45878-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> With the earlier sanity fixes to driver_deferred_probe_check_state() it should be usable for the pinctrl logic here. So tweak the logic to use driver_deferred_probe_check_state() instead of driver_deferred_probe_check_state_continue() Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz Change-Id: If72682e0a7641b33edf56f188fc067c68bbc571e --- drivers/pinctrl/devicetree.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c index 9357f7c46cf3..1ed20ac2243f 100644 --- a/drivers/pinctrl/devicetree.c +++ b/drivers/pinctrl/devicetree.c @@ -127,11 +127,12 @@ static int dt_to_map_one_config(struct pinctrl *p, np_pctldev = of_get_next_parent(np_pctldev); 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) - return driver_deferred_probe_check_state_continue(p->dev); - - return driver_deferred_probe_check_state(p->dev); + if (IS_ENABLED(CONFIG_MODULES) && !allow_default && + (ret == -ENODEV)) + ret = -EPROBE_DEFER; + return ret; } /* If we're creating a hog we can use the passed pctldev */ if (hog_pctldev && (np_pctldev == p->dev->of_node)) { From patchwork Thu Feb 20 05:04:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183654 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp140995ile; Wed, 19 Feb 2020 21:05:07 -0800 (PST) X-Received: by 2002:a63:513:: with SMTP id 19mr31590569pgf.28.1582175106861; Wed, 19 Feb 2020 21:05:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582175106; cv=none; d=google.com; s=arc-20160816; b=sL8mNPVvZ7i5sAhTJj/045qpoVaMPGMM63OWLThyTD6vjKe6EH4zMYUFPrE0+P4Q4z lBfm4Yg4lvXMR8IX5XMG82LbhM6+RIFcT5J1DctRytAFZdX84Zx/PLGKi4Pcj7JSsi/n 8q/MvB6LnV6D7TXyOUzNx0tj1PYUgjgtRbIDAP9yqJAkL7AhA7aWXrX8qEa5VdlwznLM E9d1U3e9QNz8UTY1Ke6fdcRbkJz0u5v1MbvPcpQKCoIf8ePHNp+fkxafYV2AU9Z3DxNm J25lcLTihEz31r5Y+wNF8l7NGyAKyQxleHQ4IWBxb+8+zkvy1KNfEnjcMNc/BRdk737n 74BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aixlBG1IUMuyRnlbsO9Bddkyq8kq21Uvz9l57YstKEY=; b=gq6xmpUIpwuiJgq2tg6sp7KjaagUOiag7ZtCkMu1lCMDiU1TeYZVazEHFcFqNZaq8T bQuaJqZjhqJ8S9xjLI+G7pakoaoRwRdPJuD1sSoQ64zJF07934Lj+BtbEk8lv/cRuaUM Mw0UlMCAMEoMq6j6mFFpOZg8tMZucfoJznC4R16Bk15DSVOsoy78sza5eTd4zk5N3z+j nle56FTplnaffnp7M9fXQaylrWWo8coIKmtMkmtab0NONzWUwv7hQmphhTai0NSe8UEm ZMGQhh8rU2aGJwIdtSvBk8yf1mATHH0VNlDbhYhDluk0SatGPHVvknPe8hJRY5hHC1pS 4bPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j2ufgc2A; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h3sor739436pjq.15.2020.02.19.21.05.06 for (Google Transport Security); Wed, 19 Feb 2020 21:05:06 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j2ufgc2A; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aixlBG1IUMuyRnlbsO9Bddkyq8kq21Uvz9l57YstKEY=; b=j2ufgc2A6/zlTZrKnv+kOV8+1hQXXn3hsLZe88ekx9d15lUcmJnyFUmhDsip74svCh pr7/+G5aP6LdzE4a7lEJUZgNTJMhvYQE/MKQ4aG/rMEG02biDlVWqaIUw8PgVwbDxwS1 dSJ/9VHA7hhoPMtn++Xrple53Lem5Nsayidp3GA+3+TlpYNWCwa+N3TKHz5zYeol9AUp trdAnxxH31Bt/cY/j24Bq+ddIJ0mb+gOBv9XXnT3AUQdT4FVG0FHMS/eyoxgshaj0aDe NuXP3JUSwR6i0KECbbq/OVFbX3uAJmVBj+k/4sVu8kBtxetNlMs4NXbFXIasx0g2OUz6 U9Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aixlBG1IUMuyRnlbsO9Bddkyq8kq21Uvz9l57YstKEY=; b=oUCIi194FYQ8jd/O1g8KntRzYq3x86V0XhlDWjgYwmbZBAaivYjjQpwBr7DCdG4r+f E3sXPG3r1z9qp6cumw2a1KHeO4ww0Hr1/7Kf2B3GIkM17IZsfsGWW+M/oYe2f/p8rSMQ CSZkOIx/XwZy4nP8bMLXDmXK5PuRq5xjL7JzKkncAfbwb64svyuJ/lB5+eVbB1oyzlfB Gi1V2fGKQ5PaM/jSlMSb3OZDz5TBoE/Ew/f3hcVz+TJgANiVM7Zs1GaVQGqBGJh4YOoa eHzGNl99Qe6Ub8TpEx4R4B9rRBmSKaKGH+Ezb+e9GgLk4gsGViVaEYif+dY+30jP5ucK J50g== X-Gm-Message-State: APjAAAWTOSadiTCPGUNa2rjmx6p4Ql4csaXnnWSvEpdr9DYF3feQDySg RoRhgJ+7vz3Y8wbPrv9eqXqJ7rJj X-Google-Smtp-Source: APXvYqzmBhGA+NC9IeOnvf5JOOp42iqCCjHX+Qckv0WLtqV7PEDyvMGdktmnkX5JTyIHsNGyOPPQUA== X-Received: by 2002:a17:90a:cc10:: with SMTP id b16mr1393657pju.55.1582175106420; Wed, 19 Feb 2020 21:05:06 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:05 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 4/6] driver core: Remove driver_deferred_probe_check_state_continue() Date: Thu, 20 Feb 2020 05:04:38 +0000 Message-Id: <20200220050440.45878-5-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> Now that driver_deferred_probe_check_state() works better, and we've converted the only user of driver_deferred_probe_check_state_continue() we can simply remove it and simplify some of the logic. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz Change-Id: Id5cd5e9264cfb0fbd70a702715174cc4b10006f4 --- drivers/base/dd.c | 49 +++++------------------------------ include/linux/device/driver.h | 1 - 2 files changed, 6 insertions(+), 44 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index fa138f24e2d3..408e4da081da 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -244,19 +244,6 @@ static int __init deferred_probe_timeout_setup(char *str) } __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); -static int __driver_deferred_probe_check_state(struct device *dev) -{ - if (!initcalls_done || deferred_probe_timeout > 0) - return -EPROBE_DEFER; - - if (!deferred_probe_timeout) { - dev_WARN(dev, "deferred probe timeout, ignoring dependency"); - return -ETIMEDOUT; - } - - return 0; -} - /** * driver_deferred_probe_check_state() - Check deferred probe state * @dev: device to check @@ -272,43 +259,19 @@ static int __driver_deferred_probe_check_state(struct device *dev) */ int driver_deferred_probe_check_state(struct device *dev) { - int ret; + if (!initcalls_done || deferred_probe_timeout > 0) + return -EPROBE_DEFER; - ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) - return ret; + if (!deferred_probe_timeout) { + dev_WARN(dev, "deferred probe timeout, ignoring dependency"); + return -ETIMEDOUT; + } dev_warn(dev, "ignoring dependency for device, assuming no driver"); return -ENODEV; } -/** - * driver_deferred_probe_check_state_continue() - check deferred probe state - * @dev: device to check - * - * Returns -ETIMEDOUT if deferred probe debug timeout has expired, or - * -EPROBE_DEFER otherwise. - * - * Drivers or subsystems can opt-in to calling this function instead of - * directly returning -EPROBE_DEFER. - * - * This is similar to driver_deferred_probe_check_state(), but it allows the - * subsystem to keep deferring probe after built-in drivers have had a chance - * to probe. One scenario where that is useful is if built-in drivers rely on - * resources that are provided by modular drivers. - */ -int driver_deferred_probe_check_state_continue(struct device *dev) -{ - int ret; - - ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) - return ret; - - return -EPROBE_DEFER; -} - static void deferred_probe_timeout_work_func(struct work_struct *work) { struct device_private *private, *p; diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 1188260f9a02..5242afabfaba 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -238,7 +238,6 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); -int driver_deferred_probe_check_state_continue(struct device *dev); void driver_init(void); /** From patchwork Thu Feb 20 05:04:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183655 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp141055ile; Wed, 19 Feb 2020 21:05:10 -0800 (PST) X-Received: by 2002:a17:902:9b8b:: with SMTP id y11mr30415984plp.189.1582175110282; Wed, 19 Feb 2020 21:05:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582175110; cv=none; d=google.com; s=arc-20160816; b=Dyu3CpCyhXlMNVlv7U8ThTK1+MHV1xs2PO+fWbWASK7RyCkz7n6hye3lQtqcqvo+bn UJzjOcp1D/KtqNpTbvygX0+7RZezaX28Ch6bIOVu+dIJRmc9xdjON13D8+h/ZB3upJRE e4Cva0pYdb6Uf2Fb9H/79VyM6GFLrN053hcuLgSf2WcwWR1OcWpwh12GnyY+GAenbtK3 80o+QHdezpE7cRcWZAnviYdPIVsV4l4moBsf5B196Nn9Nck0L6EX1AScpl0TfHX4EbF5 MIbm+d/ClLHwrGbsSKiEVSkBy7CIKnlMbu/h4Om6SOTV5TFwmWgf0RMuwBW9I1npLHDu QXCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=BoWCoZRXomba4V/GQ9rnU2KelGn6IYNx6JgAzy0cALQPsZlAulNwv50DnPVoyK57C2 C/FlYXlwNSahlgndPO8maIzLVQZ/NqIEDJz/5VTOezZgj5Nwzr1it1ttNX37OFMRsHmM H8h04T/pcRwOaW9kNZ7PImta3+IZuUWgFxk9QsdUI9UsHqfZif4NZ2Fv2MYN8qHMZ1sc i2cER9wa/amf+lFZ+B0XM3hF9GG2NEm1xWZvMDvevRmyKcapDUbXPapincwTOMaq497f T+czd8QLHuSKuc+urg+v7IO28hak8bx9OpGXmb4zwW8YOz8qIQnttK4evTLgFzijq7aG XpdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KWtAXqoH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u2sor1914514pgp.75.2020.02.19.21.05.10 for (Google Transport Security); Wed, 19 Feb 2020 21:05:10 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KWtAXqoH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=KWtAXqoH66/xVX33DhMaKTUdGX6Uf98AbL57ah+k6dEdauNQwApvPnNPHUiivq6Jdi 49xLg0mTm79BVYHbdcVGHKDyfCI7Yt8YhnlXGJHea2d2Y16+X+iCM76wvPNmXrV4dhfb KKtxMQCoagp0X+c11lVO9afWRHTd6fPbsvUjdhWnY6dEPBMgam5bDsEJ0yD01A23gyxO XyvFyW3dEfa9OwDK55NIUQRusiahMNtBIZGwbpxIjB1xAdamE56cpYEcFU/u6PxFnaWt V6wbP8AjfqY2Y56H4t559cVNwx9C1p0h6Vw2CRmcPmowj7AN8PIhT+73joESZcCRHPmP 3dBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=eKe5+T65PSqkFDSf54w1+M7HIg+kIpDNWFq1KBJhJBcxhGREuE+z9iIEhwnV+L9UKW ZajCVMQDJSPrEQYpa5M7hy7SpNAZLLru7Fs+LPgT205VJf/r+JQyenL03EsLKxqSn3G9 8I0F1jDyrtoVOb89bdduEGEgvuCm1v/noJLgIdQap/Y6AJOc2GsDQfJM2GsbS3gozhqN rtesZ/IlKPuQn4aWA7OKYp+0hkPVoE67xiWSPn2hoiPqw9zdc3fdpU023zTA4shUE9g3 3M3n6lrv83yo207Cot9yQxoBwbq/MKGOPh/XExPmWOFuLA0DVuxYUSoQsPNGY6DOC/II gmOQ== X-Gm-Message-State: APjAAAVQi0PG5r8xLdIp390Po5FzyH5mi5WVdEF2vxLV+1dQU3t6RkHl l3Xe+ji1JoKHKdnwpwkaGZLk/i7/ X-Google-Smtp-Source: APXvYqxtOMEIAg/0vMNdo4l2g1zhUCi8GqsKzxUcztilwfCWBSoXPh54dpJIreh60u0UmWS9iVnVSQ== X-Received: by 2002:a63:fc51:: with SMTP id r17mr31212077pgk.292.1582175109855; Wed, 19 Feb 2020 21:05:09 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:09 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 5/6] driver core: Rename deferred_probe_timeout and make it global Date: Thu, 20 Feb 2020 05:04:39 +0000 Message-Id: <20200220050440.45878-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> Since other subsystems (like regulator) have similar arbitrary timeouts for how long they try to resolve driver dependencies, rename deferred_probe_timeout to driver_deferred_probe_timeout and set it as global, so it can be shared. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz Change-Id: I92ee3b392004ecc9217c5337b54eda48c2d7f3ee --- v4: * Split out into its own patch as suggested by Mark * Renamed deferred_probe_timeout as suggested by Greg --- drivers/base/dd.c | 18 ++++++++++-------- include/linux/device/driver.h | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 408e4da081da..39f1ce6d4f1c 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -229,17 +229,19 @@ DEFINE_SHOW_ATTRIBUTE(deferred_devs); * In the case of modules, set the default probe timeout to * 30 seconds to give userland some time to load needed modules */ -static int deferred_probe_timeout = 30; +int driver_deferred_probe_timeout = 30; #else /* In the case of !modules, no probe timeout needed */ -static int deferred_probe_timeout = -1; +int driver_deferred_probe_timeout = -1; #endif +EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout); + static int __init deferred_probe_timeout_setup(char *str) { int timeout; if (!kstrtoint(str, 10, &timeout)) - deferred_probe_timeout = timeout; + driver_deferred_probe_timeout = timeout; return 1; } __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); @@ -259,10 +261,10 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); */ int driver_deferred_probe_check_state(struct device *dev) { - if (!initcalls_done || deferred_probe_timeout > 0) + if (!initcalls_done || driver_deferred_probe_timeout > 0) return -EPROBE_DEFER; - if (!deferred_probe_timeout) { + if (!driver_deferred_probe_timeout) { dev_WARN(dev, "deferred probe timeout, ignoring dependency"); return -ETIMEDOUT; } @@ -276,7 +278,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) { struct device_private *private, *p; - deferred_probe_timeout = 0; + driver_deferred_probe_timeout = 0; driver_deferred_probe_trigger(); flush_work(&deferred_probe_work); @@ -310,9 +312,9 @@ static int deferred_probe_initcall(void) driver_deferred_probe_trigger(); flush_work(&deferred_probe_work); - if (deferred_probe_timeout > 0) { + if (driver_deferred_probe_timeout > 0) { schedule_delayed_work(&deferred_probe_timeout_work, - deferred_probe_timeout * HZ); + driver_deferred_probe_timeout * HZ); } return 0; } diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 5242afabfaba..ee7ba5b5417e 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -236,6 +236,7 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) } #endif +extern int driver_deferred_probe_timeout; void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); void driver_init(void); From patchwork Thu Feb 20 05:04:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183656 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp141078ile; Wed, 19 Feb 2020 21:05:12 -0800 (PST) X-Received: by 2002:a62:ed19:: with SMTP id u25mr31187813pfh.173.1582175112092; Wed, 19 Feb 2020 21:05:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582175112; cv=none; d=google.com; s=arc-20160816; b=MKcz6sTPLUakzt+SNucWD0l3Gbf1+hhPCLV/iNBW6S80D+bhVllTY4U1kqZ5Mtchaj UghOFM+/E7itcyVOWc98iOTKt4jcIcJ5yHISq8/aPyWk4jG04NXDJrNdbZzDYXFelfp2 8XQ93HbcrAQaLkRCTG3MrVFk6JzESqNH4f6RHO6A+jSH/JZfmvSLrMTE2m+1SjFwYrOM z6F6S2wKVZK9NGdJdX+rzGuKr52uqFQvkxj6JExe5wksE9priABtEPfhePTYFLhhZlsj r4c7ADKwJeeLYy3hW4+NU/BdpYngBI+jn4kBgzPj/fayiFytf09mKWWrpJ9BqhkWKKPu c/lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BkWD602W7Q9Y+URRx5RQh3vyLJ/+/ea+Ab7cyJ2LVzU=; b=snt9whw6cmjPsIRqQ+69feBzmWnSEh0xmlWqQCz6BivbNuuOMFw92cOvI748/yPQNp fatF/+50/a93/+J4dAT00JRDljkA1W324UGj6sw5Ba+py1Xa9sfU/pK2XdGwyn8Df856 NSsIAYn37yNr1oovbAv52qkWX5VhrxRSoc09XCmcUWWi4rn1OkVq1WegcmvkHAr3EPob UBtVKzDFZnhNapqXgHxEFqoOXs9oi5CyngfF9hftlS1ErwQ1r/d3evoWEtm5ZbZCa37V WLwtyl6PcVVOPVkaIL8dlrYYmrhPhVx97luk/AgMBVTTkIscYA8nMuTp8cgbKxC4INDi KDQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W0USwnkt; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z2sor2046802pgi.16.2020.02.19.21.05.11 for (Google Transport Security); Wed, 19 Feb 2020 21:05:12 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W0USwnkt; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BkWD602W7Q9Y+URRx5RQh3vyLJ/+/ea+Ab7cyJ2LVzU=; b=W0USwnktWAK949xSvqdULNruXCEUOenrU262+fUtA5vIIvMRyM7oAKyJ2bEQImhS6m K1AYiV0U3IhjqjrBZ7WeSj+TEmzIa0CEdiE1NK0sKuRLkPKyAgJeGCfOiDCEqGoIUGJN 4W4IICZWBwQz9RJNue/bLLa+h6Q+MR8Im/7yxK1qUkPLuoZgprZfGo7P3PO7f89j9t+a I9rc1moqCiUG4Nktof1lcbQmGnz1w3NEOogwoKftsxf3Wyy3TbLs4dSBlmNav/6MLW1Z a26GHEo+6b7/2njVg0CKhg/mBjpSSjop2uLJ8ki2BG/MRcqeDZ2/NGtvq9sc38FIe08y tkGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BkWD602W7Q9Y+URRx5RQh3vyLJ/+/ea+Ab7cyJ2LVzU=; b=gAr3RorrC9XC2cTJSEGU/Xy9BKs5+whL16oCmcnzUV3WBWtr3pcjTiv2uPdEs+RiaF Js2/v9jw2kKhdLkNqdxmDdhdD39SkAa2AtcRwC35k6nCMBEG5KOzs+tPBcupGK5QQi1i x4vWLMl1Esk3gRVF8umAFMXzpMMIWmP9WwFCbutKT3La+ZfSnJr3qwhqFhQT+Zs9F4u3 qYuAy6NP2eP4RKTfpkKfxi5i4HXO0uHvbv/bGbE2wDqkutQOn2v9XOewUah/SDrizU18 BLbicZvF4sA+yFuVdSp+jgZzcPYjKHbRmg1K6YgjzNjB6c4DdbudJqIPBYB/xZNA7o0e cCTA== X-Gm-Message-State: APjAAAUwmNRiHZe94g0/n39319i/b1XB9xD+IrpQHeBLz963cJ4EO57j Dl5SO6vwCa1WLXCO67NBbYnLgEVK X-Google-Smtp-Source: APXvYqxpWD81Pg4dHENS3JJ0u393+opZJgCR2EPptBx14uageSAhKbCtURu5uLMMtHA2wUTm2HBiIw== X-Received: by 2002:a65:478a:: with SMTP id e10mr30287883pgs.197.1582175111731; Wed, 19 Feb 2020 21:05:11 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:11 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 6/6] regulator: Use driver_deferred_probe_timeout for regulator_init_complete_work Date: Thu, 20 Feb 2020 05:04:40 +0000 Message-Id: <20200220050440.45878-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> The regulator_init_complete_work logic defers the cleanup for an arbitrary 30 seconds of time to allow modules loaded by userland to start. This arbitrary timeout is similar to the driver_deferred_probe_timeout value, and its been suggested we align these so users have a method to extend the timeouts as needed. So this patch changes the logic to use the driver_deferred_probe_timeout value if it is set, otherwise we directly call the regulator_init_complete_work_function(). Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz Change-Id: I9fa2411abbb91ed4dd0edc41e8cc8583577c005b --- v4: * Split out into its own patch, as suggested by Mark --- drivers/regulator/core.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d015d99cb59d..394e7b11576a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5767,18 +5767,21 @@ static int __init regulator_init_complete(void) has_full_constraints = true; /* - * We punt completion for an arbitrary amount of time since - * systems like distros will load many drivers from userspace - * so consumers might not always be ready yet, this is - * particularly an issue with laptops where this might bounce - * the display off then on. Ideally we'd get a notification - * from userspace when this happens but we don't so just wait - * a bit and hope we waited long enough. It'd be better if - * we'd only do this on systems that need it, and a kernel - * command line option might be useful. + * If driver_deferred_probe_timeout is set, we punt + * completion for that many seconds since systems like + * distros will load many drivers from userspace so consumers + * might not always be ready yet, this is particularly an + * issue with laptops where this might bounce the display off + * then on. Ideally we'd get a notification from userspace + * when this happens but we don't so just wait a bit and hope + * we waited long enough. It'd be better if we'd only do + * this on systems that need it. */ - schedule_delayed_work(®ulator_init_complete_work, - msecs_to_jiffies(30000)); + if (driver_deferred_probe_timeout >= 0) + schedule_delayed_work(®ulator_init_complete_work, + driver_deferred_probe_timeout * HZ); + else + regulator_init_complete_work_function(NULL); return 0; }