From patchwork Tue Feb 25 05:08:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183809 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1262790ile; Mon, 24 Feb 2020 21:08:38 -0800 (PST) X-Received: by 2002:a17:902:7589:: with SMTP id j9mr53250933pll.312.1582607318195; Mon, 24 Feb 2020 21:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582607318; cv=none; d=google.com; s=arc-20160816; b=cny+HUbUpJQ4SnvBJFmNHEpFipmzjVm1SO9TQvfZGx306o3vAc1leryhpGbc8EgRBF 009RlXTes8X3gLwy0zLjTY/8UGKnD4XjrNb6WPJpluEE89d4SBo2Qd50RgKV+GWImwrZ rC4CPWlg4HBbRuCVmotxO4sqcPiiexvIfqxRLswF8o72UXaeyrKQCBY0FQG0UTxvP3C4 O05etqScsUuAXSbR/4nM7BSXzjoBXIUjhjMrgKASJMIClYv7zjBxoVXjlpZ7o3ZH4If3 EP4im8CLARAfsFwxFm/uh3cF7yjZN+kp0khjpv8Ju1PrLJFYKylbluZi8sxUAD5h6ZOy /QfQ== 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=VjGy9mDSQTtqTfodJGzoJsBP+0BqRCAD5WnADk/Arw0=; b=Kf9HFKT0GABinO1kF6WoaeJ6XnwZDgNlHkH3lYQOJ30ffAHI9DSTOmPDlgHR0y12W8 kUuToR1XpbQ7tlF2Rx134UyNPUDWqTO3AEMwea/HydTfZWouysGOR3OqaeCKOcWgylMM W262kfoxT3jlKl7k1CHcfutkN39v3TkX69bBY4O5tPVoFI2B5x5D+vK7j+++29I9jXKG S3NTIdl/uoU6wYvuGkaZ0FupGzHu0t3AOHHuRtm/+EGrZoZHnaqxXXGOcHF7AWqVlRui 0GQmDmMUVPwvVdxnffFWLbI18WivI0sZMwbkv8KgFx+Xs+VuBDtFWx+3LjUr9QAJMe/J ukWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QWV3p9i6; 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 y14sor16251175pgg.66.2020.02.24.21.08.38 for (Google Transport Security); Mon, 24 Feb 2020 21:08:38 -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=QWV3p9i6; 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=VjGy9mDSQTtqTfodJGzoJsBP+0BqRCAD5WnADk/Arw0=; b=QWV3p9i6zgdUqYL2d/2B5WDRt4NHawZ9OByHIbJAMrmiLd0KSO3xLeTNpgJVmrcp/0 xqki/c8H0Iv/9yANo6VcgCAnCWj0iuko5+4Zdp5ODNwpyOHZWaIktGmCJ4nXAC1JJFvd 9R0uvmxHps9ROinDk3kyZ1XeAxdr1S8gUarQvwvao6S4nhJ28Mb+vxsSFiHYEQ77omgN 8YI9LWrxpITC+nnOg+Pl1Y8Wg8b7YZ1plkloQDfuNpIDS1xzwboO0elIFvuYW3y2r778 3CTF+ftFwL+WNquuDIU4RbR2zZrtmrpGNppSCYBZdzbJkCqbczkrn/uvD9cmlAewHCBb ugsA== 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=VjGy9mDSQTtqTfodJGzoJsBP+0BqRCAD5WnADk/Arw0=; b=emrSFBOKW/XeAed5DmjflNUUGuwW/eVhGTck2HdOkfUcY08vS8a7O13oHAwUjPfjhC oQU96HbsKxKvHF2DVQa6WUb3f4m8QGUuTpHvhGExDsSkmvsvIswBfBw5C/BzSB5V6IAl lv9LaZXZkKK2HoSLGnzTE1pX0+mHA+yodKUEn+LBGKlxQX4thuTF1On/ARnL7E781QBn tf6E7NUHk5Ce/lCodJRn3GESej0/KCFeAhKBZio9/3Bme/ds6RFE16ttQk0zODQkqaQj fGjUiuCt7N0373tkHL5hrtqUDyMd9eooI5lyGmbdIbnAQw+1xbePFjmXz/WXulPuHzw2 livA== X-Gm-Message-State: APjAAAWWyGzEazI9HizbiuryIxRcD8v5F9bQGE/qIBovNaRmOFqslI10 C8jDDO5oHHMm2ud3HNuPAJD2uZ6h X-Google-Smtp-Source: APXvYqx5KRNfMIWOAh/4UQZeEBO6iVmZ2gYODKQvJ1DZC3K6GWCUjoTKnkYshlse4PleF/uQhjP5Qg== X-Received: by 2002:a63:60a:: with SMTP id 10mr49705597pgg.302.1582607317741; Mon, 24 Feb 2020 21:08:37 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:37 -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 , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 1/6] driver core: Fix driver_deferred_probe_check_state() logic Date: Tue, 25 Feb 2020 05:08:23 +0000 Message-Id: <20200225050828.56458-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-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 late_initcall has passed, and modules are not enabled it returns -ENODEV * If modules are enabled and deferred_probe_timeout is set, it returns -EPROBE_DEFER until the timeout, afterwhich it returns -ETIMEDOUT. * In all other cases, it returns -EPROBE_DEFER 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: Saravana Kannan 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 --- v4: * Simplified logic suggested by Andy Shevchenko * Clarified commit message to focus on logic change v5: * Cleanup comment wording as suggested by Rafael * Tweaked the logic to use Saravana's suggested conditionals --- drivers/base/dd.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index b25bcab2a26b..d75b34de6964 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -237,24 +237,26 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); static int __driver_deferred_probe_check_state(struct device *dev) { - if (!initcalls_done) - return -EPROBE_DEFER; + if (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) + return -ENODEV; if (!deferred_probe_timeout) { dev_WARN(dev, "deferred probe timeout, ignoring dependency"); return -ETIMEDOUT; } - return 0; + return -EPROBE_DEFER; } /** * 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. + * Return: + * -ENODEV if initcalls have completed and modules are disabled. + * -ETIMEDOUT if the deferred probe timeout was set and has expired + * and modules are enabled. + * -EPROBE_DEFER in other cases. * * Drivers or subsystems can opt-in to calling this function instead of directly * returning -EPROBE_DEFER. @@ -264,7 +266,7 @@ int driver_deferred_probe_check_state(struct device *dev) int ret; ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) + if (ret != -ENODEV) return ret; dev_warn(dev, "ignoring dependency for device, assuming no driver"); @@ -292,7 +294,7 @@ int driver_deferred_probe_check_state_continue(struct device *dev) int ret; ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) + if (ret != -ENODEV) return ret; return -EPROBE_DEFER; From patchwork Tue Feb 25 05:08:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183810 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1262840ile; Mon, 24 Feb 2020 21:08:41 -0800 (PST) X-Received: by 2002:a17:902:aa88:: with SMTP id d8mr954840plr.201.1582607321584; Mon, 24 Feb 2020 21:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582607321; cv=none; d=google.com; s=arc-20160816; b=iiow/EWvmatJ7OYDbGaVaZdy+aOOCtJlqgRZ2su4Vuu609t2/HDooSvj/mCaElpZwW EoKvsVoeScFcASvbiRZ/V7oLUKyBM9YXUe3ikmM4YOOHoZMgF1USxnj6zgFrgt0MARnw CjMZrNBmx9o7RvpZyqbQ+LnkHa3C1m9FrfAV0k6SSvb4DBUxUwUNLPCzHvIXIe4Ijx2j 4gUmTBEqtFI1TYqSIBCEf9NTK29EPT2ZQVb0JySohAq0Grw6HuGm5fJf18KzVuz6Kij/ TjwMh2igMUJQ/LIr5vxQzOSqSG2KQ6XxmyvwDSOKL3ocbBBSAkBcYnL4C2t6RX8a2GQF 4Q0Q== 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=bdantuu/5XxtE9f3CRUqpZsUq5/+hM9onGf3l9IzGoE=; b=0fNRDAduejnw7HZ4kl+1Df1D1eBW7kDWroMrOlOhf2vZLW3W45VGACxiLwwUPpn9LM YjzPkuLTXbzRmwfsUscL0qkC80IoiRVAdWDzTbiwKU7n6u/FcFURod4huAKryAw2DyRF +vXT9Bzp4R6Pf59mdPZIZflEkGtLrRe6Q+GZvOSASYK+CSsS249O6wnZh+iRiwng3jxe o4N6XYsoF/gGj3tRuz/o/o4X97RgCoQuZ5sHM0j2H6R2S5oIpJ2zq3UkXNwsG5YSIC7u mxeQyRQzAVSqerKIMsN9KD4VE7mWZcr2AlrdGb1AshDJAQeJYtODzlHeXtzXdsNWrTnN /Alg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eseBaJpt; 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 l24sor4940730pgt.37.2020.02.24.21.08.41 for (Google Transport Security); Mon, 24 Feb 2020 21:08:41 -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=eseBaJpt; 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=bdantuu/5XxtE9f3CRUqpZsUq5/+hM9onGf3l9IzGoE=; b=eseBaJptDm8Ew+v8SqbkusD/nIsIJS5Q63dC5indg6vPCEKfEsMcIPCQ8LryIf6XAJ luL/+OrUx2Oy46HC+ptZ0HilMyfsc3zomlNmnYnHrzOLjZXAFyJ08p9/b5DGXYu8eaNo PUEltGUedjDLPkqZYyTqtRnfnUv2t/X/LDaRewmylTEofSd4xUVGA5OvCe0kLjUwXBn/ CRfUhK+/zob1g6uYsBJXymtFuGPFlDawi9R0laHsTU7R41pTUTtrKve6Bra6du4WP12c XCipO95SvbpgfSoF3P77ZiAEQSxcEhkwIXQFr7HKn24Gcs06BdepRKmhhhLGfZjwPG7U nieg== 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=bdantuu/5XxtE9f3CRUqpZsUq5/+hM9onGf3l9IzGoE=; b=bItBCEcEYWSaqJMr1s5/OfkJkkMjqEnnR+Ob5+pxo/tcL5/aJBZE2Eczn6ttsCrurc sk2/13pl6qtwx7w/8rlUOXoMAqjOHSRTjRQrg6Bxdesk9fmvMENtCugjzOyhgai3cnx2 mKy+RoXwIvtJAqVcFkSMlnM+0351PvENVVq/LaPv1LD3Pf3x7HxUTVd/HJZEvGIGizeg YGql6tNhxWqB+FKEpoLmmkiSR2qZgR3gPc1e/E8c+RshyfRqn2MQBbc3VBsHazKXXXK5 6RO2tq3o8VrJB3CN5ikDoqI1cuiZYf8CyDxpeWfRJRej/3SpyW5JfDRUkqMQ46GFypVg WykQ== X-Gm-Message-State: APjAAAVFkaTQs0bkpVluj7qWME5cdUfEfqWGKxaMMbx3OLK1oXjqCehO s7wrh1czpYzgPFZETAqjfDLr2f6r X-Google-Smtp-Source: APXvYqx5Kz8YB9icmd79yhCto0VvLnWu8Muf2e9T+i5OFmjE22x563qcKYydlVaxtypL+7AeLyRalw== X-Received: by 2002:a63:e5d:: with SMTP id 29mr9354407pgo.124.1582607321206; Mon, 24 Feb 2020 21:08:41 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:40 -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 , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 2/6] driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set Date: Tue, 25 Feb 2020 05:08:24 +0000 Message-Id: <20200225050828.56458-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-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: Saravana Kannan 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 Reviewed-by: Rafael J. Wysocki Reviewed-by: Bjorn Andersson Signed-off-by: John Stultz --- 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 d75b34de6964..fe26f2574a6d 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 Tue Feb 25 05:08:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183811 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1262897ile; Mon, 24 Feb 2020 21:08:45 -0800 (PST) X-Received: by 2002:a62:17c3:: with SMTP id 186mr55996777pfx.158.1582607325531; Mon, 24 Feb 2020 21:08:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582607325; cv=none; d=google.com; s=arc-20160816; b=ya5DA+tbYs+DsOsJ403PhP2ztNPPaLSlrF6efHWQdiaA1ow7jKA9yV7S4Xiu2HsYPN EUMeRBr2vvte4hS6H0DHmlC2xQ+XHbBzBijninyQR/zjEr7thRgQF9neEcflvAaoFk1t WlmRWN0+UxZ8Uwt1tptFZqQ765r/fTep751kea82jZQU5s2ezeGn18kZaQhwYimnxH0k 2xYGfjiax0f0p4WGnotGcodGft1KhWqrNpWu+AwOl3Y+yIMVr7uSIHv0GfXjvgQdkjrl nSUGzh92IN+mXyRsXc1J+MWHwqemmqw9F2vxKxEu02PG9I7IdwJ/4q27kYNRBDfgfn2r ygxQ== 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=UKu1DiH1aE4gWTyQt4rVDR13BTjgcFDoUNycgrJmwbg=; b=QEajcFV1SUfoECbrDDuKsD0JQ1rTGWX1kbdowzcsZx3OVoHh1YFV3U9z4GTnOzyMKN hn0bb9aRZIJOS45m/LCLj2buBuZlDxWtER3Mvn6LU0hiinRGxL4rDcu4VDfqdQV45YYz O8ORIxrRdHkJdDvxcQnISzdERsF1hKBXsU9NnE8a3PpAo1WINeFM7QQGMEEie5i+WjpJ LlaklC3u6iIipf7vZwWp1ZAw2iuO+07oSnnwBZmxwWvfhFDcCGp+MTSKSQN0pU1EUvhq b6ahX2cNyB9eLW0o6jr9F8Vrvz11mb+1y5jsFdqsiouoBr+rVl9KzDDqbvr8zD1L0i+4 653A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cu6ZP2ZI; 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 z15sor16625135pfc.69.2020.02.24.21.08.45 for (Google Transport Security); Mon, 24 Feb 2020 21:08:45 -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=Cu6ZP2ZI; 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=UKu1DiH1aE4gWTyQt4rVDR13BTjgcFDoUNycgrJmwbg=; b=Cu6ZP2ZIv35GFagdY+/LcLqaOOw+CLP2oG+i36khDGnV8jZqR9+fcfjmtSi8rmir7L Jx1LaoZjn8k7/5orzjhIAxTgMTS++qpZ/WATeHeqfZ4jMF2TstYXaTiMIt63Hf5rFPkU HLBZsZV3viwEcdZFWD4uZ3ZgmCzB54Q6z++Xu2LdT8HN4JDEUwYeMU+o2G6oG5cftukM y7ej0sQ3QrmZg8WvRtkxYZ4OdyjLUJTBxEIivl+4yyyqBrytgZceKBvx4/TkxTvlIbFa dfRZhnCHnKcjjZePiKQqRzKAcc0sYa7DHxrLEP68JvuQDo+Me44fthyCMhq4WUVHAtib OSxg== 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=UKu1DiH1aE4gWTyQt4rVDR13BTjgcFDoUNycgrJmwbg=; b=Rwkfy/Ir5AtEuzRg2dfNlQ+HzHz5UjFMRTmJCsTOnHfJB3RRhXSGZ+2f6F+c3mq58F RVKyHqUusvEju7DNXc68sqMGvgWDOUH51Tq3aq8qlDtbDhyjyPityQkzFziQVrTKKIsY dXjaOPltv+S2cwxPPxcWcfJJ0vnN6WEr0bNAw00Yp+0v8HFuvgvQzwq/QyUBEcUCOomW uWfVq97vZIddb5PA/9DwGQDj+3lYvn6s66c74GTDtDbw/NZ5yeXywctVh/JsyOf0eiju sGOrNfIWdTXzkSMV3WiJbQI5m0ajt16kJPTcxQhoLU9XbdyORj4r/T6kpyEij4Eo3KU5 fP/A== X-Gm-Message-State: APjAAAXDGJp1WMXVmhZLcNm5a0HrIG9brBRwjyqPtfjldUn3PNqo5Ni2 8QYGsFtB4U8CAfR3BSVsj4DoXlU8 X-Google-Smtp-Source: APXvYqzJ+fEVi/wIlI9WBB1N7Ce1uB1pgPc8Gi+KC1Np/LBZigKmj6Z4U+C8cgQ72ykCwoffntxxsw== X-Received: by 2002:a62:5bc7:: with SMTP id p190mr53865844pfb.16.1582607325037; Mon, 24 Feb 2020 21:08:45 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:44 -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 , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 3/6] pinctrl: Remove use of driver_deferred_probe_check_state_continue() Date: Tue, 25 Feb 2020 05:08:25 +0000 Message-Id: <20200225050828.56458-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-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: Saravana Kannan 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 Acked-by: Linus Walleij Signed-off-by: John Stultz --- 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 Tue Feb 25 05:08:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183812 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1262974ile; Mon, 24 Feb 2020 21:08:49 -0800 (PST) X-Received: by 2002:a17:902:c693:: with SMTP id r19mr56698556plx.25.1582607329628; Mon, 24 Feb 2020 21:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582607329; cv=none; d=google.com; s=arc-20160816; b=UFrme/bl1Zb3ZJelBC+MPVzHSq9C4UHRZlrRMi6fFgWmFm0ID77P3ipBSqKAGqLu8A kqjhUorU7BpL5LVikkGweqSKLwHVxRMqksfDOSqAVWsc0JiVmO2bpc0h67f+LCpQACaJ zPErNxy18vdVFjQszUx9qVNFEzGlzM10xpcHgrAOQPMq5Q6WW0pvKteqapq2flUcfp9J UlH5Ev0QXOv0OtIl5AFNol14lYhmQinCOdd48BPQFKlbt4aDDfEPPjgqsmRF5bJofuLs m7Vl/YFByLNx7bbWshTRyBbZQmTxVavmufgq+ubzgtwKtdXCaL3yVGKD//xFfxMtNfEb Gn3g== 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=4dT1j16IciiytxpKHBSJM5MDLlGyaxsTmdCg+EeHcyk=; b=PizKmxtyR9iwCVKEcCDgNvGkMxLZ8YE8Pc5KRT8inQPLOuDdnZVoqHCvVkfz9oo9/a X/GtKC/+yz+gxsTTmTMGkoNbh28iToURR8g5nw739it6EXAJ2Iag9FJ4wTXXq6FGl9iw wdJv6X5Lx1sVS8TaZElbKYfOHOyvfYhg+bV0RuigC50ayKlgn6IfqQEmuMDI6OyJX2vf ibAcNlAU1Pf0O4dWOmyxDi4/hgkTY7T4Q0QhTMgDUFMp/So4IQmeIIpqTSIcVQZ6ltVq vNVu0Ow7EuCkNSAEX6GqjHDz8C8IHZ6YaUKniOWBdtlZ0KQcP/y/99pqBZ1oJL7Lqwp9 AHNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SCflCDTn; 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 4sor16166867pgk.26.2020.02.24.21.08.49 for (Google Transport Security); Mon, 24 Feb 2020 21:08:49 -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=SCflCDTn; 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=4dT1j16IciiytxpKHBSJM5MDLlGyaxsTmdCg+EeHcyk=; b=SCflCDTnra+X8RiaT5pduzy9d+l2Jf7TMEo1AIIZ6FhWILO3GN9Ia4TZ8MvgxP62y6 jEOxIN/VIFGGTpmGAj+CeyEuBScAnLxMlOwd+W4x1DT/P6Bb5OdUQMHzzFAhe1BWkSxs qLo9A8M32cwjcVdF1rFjfJwcoZlXWkox2tEUaC0NWVSoJX9IY16SKE3LiMNtOTyJpZIj 21HGc6Zd+Etv8SwVpX5TnBsDF28v5Wp7AAc/ckldwD3yetYqqlLCcubZoMXJzTHB8BZC Exjz8ka1Zgo4eysigntlYUxwOsWojDKPFMZjkplzeXMpXb8VQPfXL254YlnOT0okKHuF G9XQ== 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=4dT1j16IciiytxpKHBSJM5MDLlGyaxsTmdCg+EeHcyk=; b=YHifaheBNZg6KXqttECp2IKwPVpCY/5AEzauOw4EgTl0261djTK9eeXaLoQU0d8b4r IBvhXN3rOCQfxE2f4d/GAE8zP46IZeFXfxmCdBo56UydYPaBce4G4IO1LIDEOWgiRXAk aaEN9HYF1MrLyfW1kSkqhPfsrwMj3fSCHLTsqiN9oquIEv53IAHRHcHOSIbY5KZy/4mO TXX0Jq95iePsHeKQZNtma+UOfD07VMwH9pTInDNjoQfOu6bykXGdVXtQvzQTzqOTE+/W bXFL12gqAiqpnL6SLDUXiXWtwo8ZjoRY9rV4MEbTYcQztFTISM8mDntksqSVKirIwctp Lzbw== X-Gm-Message-State: APjAAAXL1SPUg6Tx6I+j5M067OB3bWMzz9Zuv8huuitp3ptg2HxIJpNE 1Lv1EHRAXsKhqlxzzLWTk7v++iuV X-Google-Smtp-Source: APXvYqz6vMRedv6tkkMlwmoMLzeiJWwmaD/B49LsWi3HkfkxgdYxvFNQl+03CHoLiBqwx+ivrRzo9w== X-Received: by 2002:a63:dc0d:: with SMTP id s13mr54109834pgg.129.1582607329264; Mon, 24 Feb 2020 21:08:49 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:48 -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 , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 4/6] driver core: Remove driver_deferred_probe_check_state_continue() Date: Tue, 25 Feb 2020 05:08:26 +0000 Message-Id: <20200225050828.56458-5-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-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: Saravana Kannan 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 Reviewed-by: Rafael J. Wysocki Reviewed-by: Bjorn Andersson Signed-off-by: John Stultz --- drivers/base/dd.c | 53 ++++++----------------------------- include/linux/device/driver.h | 1 - 2 files changed, 8 insertions(+), 46 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index fe26f2574a6d..c09e4e7277d4 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 (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) - return -ENODEV; - - if (!deferred_probe_timeout) { - dev_WARN(dev, "deferred probe timeout, ignoring dependency"); - return -ETIMEDOUT; - } - - return -EPROBE_DEFER; -} - /** * driver_deferred_probe_check_state() - Check deferred probe state * @dev: device to check @@ -272,39 +259,15 @@ static int __driver_deferred_probe_check_state(struct device *dev) */ int driver_deferred_probe_check_state(struct device *dev) { - int ret; - - ret = __driver_deferred_probe_check_state(dev); - if (ret != -ENODEV) - return ret; - - 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; + if (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) { + dev_warn(dev, "ignoring dependency for device, assuming no driver"); + return -ENODEV; + } - ret = __driver_deferred_probe_check_state(dev); - if (ret != -ENODEV) - return ret; + if (!deferred_probe_timeout) { + dev_WARN(dev, "deferred probe timeout, ignoring dependency"); + return -ETIMEDOUT; + } return -EPROBE_DEFER; } 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 Tue Feb 25 05:08:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183813 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1263020ile; Mon, 24 Feb 2020 21:08:53 -0800 (PST) X-Received: by 2002:a17:90a:868b:: with SMTP id p11mr3140592pjn.60.1582607333172; Mon, 24 Feb 2020 21:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582607333; cv=none; d=google.com; s=arc-20160816; b=t7b/CFv6lIpOgxV5u7HZregtJLGhtnOFXof4cloxIDJTItlBWvJ0a4/TWvGqunhpnC q9m5LRskOaRD8u2PZrgcflHXo3XyAnAB6LS0OPa4GsXs4KzwtZ+NSWHBooSLh9dJU4Zs dysG2usXw4QBOhYnI7oRUhUHXhJ7V3vI+cOk9Sce8jP3OT8qMHAO13FcEQY84SbKwUwq 9F9VNhUOwGehKEdwJsNK4Tc4h7paNzmfZKv+tzC3iZaRPFV4EsGVVVMi9c5IlT4VcdZh 5hgkJOZBApm5nsLqv2BTDmpbTdrYLsQ1cyH0ayqOpwij7+KOlVWGtTWG9cidnXfA7gmd k51A== 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=al0yNnpxHbrkbnU0GkXBq3GBAXT9OW3YkTLBOR/+heI=; b=P2i1R+4J6HByBZbEmb6MhIqNhaA5C3/RM1f9kJzoPW5c3XgBA/n826FtDA37cxvBSW lhOlO1riwEhPozgqvCinMQz3uItVQRciuxlWW2IBQxfeZcrsSjcIKm8H4wGOJrI2TTJf trWlhwgerr97GTGEPwBp4gUkBjW7//DQ697IcaOwAGkIy22BYUlnB5DfVFhtghqRiJxl orbWXiMMizgt6X8XBPhpUbBqj2aLCBy8DJkDn2U7pYTU9QbgCmu55oJdaIoFeOctjB0d B/WlO7GYqMyWKgJ5GL8oOlKR2uiRvHPU4xmWZmJN+DZTNbC2v7qksNCE3Keo10zNpWvg OSrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rTdk+5bM; 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 q8sor16652230pff.70.2020.02.24.21.08.53 for (Google Transport Security); Mon, 24 Feb 2020 21:08:53 -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=rTdk+5bM; 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=al0yNnpxHbrkbnU0GkXBq3GBAXT9OW3YkTLBOR/+heI=; b=rTdk+5bMOM+HRL9wKEQyPyEKzfllOH6emQP6kJ0JbaGgfMspEx9D4EG6f07j0qZ6eA iUyyDaH6yh9/ilf2zj4FTE9BVjo+cQhw8secbrEa0uGoE/X9k+nW++hVRHfBotivunRX 7OMHcEKOaMXLp5ZWx+0l4FB/9Sy5LbtOpUflE9SQigrRwGpuE/udsdzLJFxIIBiwBtZu WKyX3NNNyGATkLWDTF01y187u6PFJp5dIAfcz7VNG4U7E81LdMhcIK3DuW/2hlsFNQRw NjDO9xlEkUm8JJI1O/3nV2c+B1lsYXls4TcWwu50hawLUD1LvKQbrX3seDfuWOjlHO+F 0lvw== 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=al0yNnpxHbrkbnU0GkXBq3GBAXT9OW3YkTLBOR/+heI=; b=ZGCcdmxYokoBXwe4tA8kMRFPNZOMWH0m67Vs04h1AtAMkeThUpC3p7X9pAtJdq8bNK ZQyWvSCpOS3MoNpjf2n7GR+WVa3DoR2Sxovq64thEFSh2761EiWvO3WkF8zk/Hp6xmqC cd99RUK/6G1Vq0fR5BfjXFqPTqo9eDbhotqCMBBBO2jGG6HBOURtk/CMGtd1aLow4Hlb ksZ6yCr2Wo4T+S/wR+vFnYaPm+JAvH2zr1IJDQRTmhttvTQag5FRQx4pVykjwFF8daRo xo7UDGTJsCBg+FyPj232V2GnDP6hDzg1dVYGVOi2KjE9Nn2ZFyAk63XiyfhDKvNHqq/B /s8g== X-Gm-Message-State: APjAAAUxT7LukmLWNmyvl2F5XjBl38TVHgOcpf7xuIZKQUcOExxw5pwa mo4DASzHOJUNnHa9+ZUHbSyvTQuN X-Google-Smtp-Source: APXvYqxhk7Ltwaas8OK1QF0WV9MG82y+cNJGjUxEKBuCHPsResxQTxX7P1XMpbhqGCukyZWZ6+caHg== X-Received: by 2002:a63:28c3:: with SMTP id o186mr36905645pgo.248.1582607332765; Mon, 24 Feb 2020 21:08:52 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:52 -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 , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 5/6] driver core: Rename deferred_probe_timeout and make it global Date: Tue, 25 Feb 2020 05:08:27 +0000 Message-Id: <20200225050828.56458-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-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: Saravana Kannan 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 Reviewed-by: Rafael J. Wysocki Reviewed-by: Bjorn Andersson Signed-off-by: John Stultz --- v4: * Split out into its own patch as suggested by Mark * Renamed deferred_probe_timeout as suggested by Greg --- drivers/base/dd.c | 16 +++++++++------- include/linux/device/driver.h | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index c09e4e7277d4..76888a7459d8 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); @@ -264,7 +266,7 @@ int driver_deferred_probe_check_state(struct device *dev) return -ENODEV; } - 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 Tue Feb 25 05:08:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183814 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1263089ile; Mon, 24 Feb 2020 21:08:58 -0800 (PST) X-Received: by 2002:a17:902:8485:: with SMTP id c5mr1103755plo.156.1582607337926; Mon, 24 Feb 2020 21:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582607337; cv=none; d=google.com; s=arc-20160816; b=AI7RkJl52JvORK8C3Ig9cr34AIOQx2l1MsFYt+mBULrQejuD1/5pEyCsllHpA8hM9M xwUXEKarShAGa4nlrWSXTz0RYrSBzmL4bAQ3xdUYN/2ke2lfsalh+AChQeQ1e1CcLyiR UXVRjZzBDfoIgjtnlYnTpULkPShvJkZ24wwUGA3p3GTYlPuN/bughHVu5lFiP69F5CwM 4RGCvEyjvhV3ThgZbqPeG6Tl0XWXv2qxF3U6Ts9pzHMftBB/xl1OejVNfJm1/JntV+0x se6ALekWi52+9a0wz2AeiLmHd7XHhhY9QoXu/iEImpXJeVlqHXi7w2rXigWWmjYNLXXj p82w== 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=vs2A4Za3pdSHZq6f79ZL4a42P4ysEMl/Adkkn+cV4Fo=; b=dkxxbiwN2Pu+sxsZeduGP4u2lca20q94Q3MpA9R9CaTgwu7jFItLzB2rKoEK6KBuB2 VjdkeiA4FiKiA/g+878Ms2C/vpxh5VxhuBqbNjMzEQy3G12jyxVoBgrdPj5hEh06trqR 99ViNJPihJxPzPB5gs7QtdfBm5sEMqhFyoZm30cOiGYX6IEL+LZ6YC+qMRhFMQOhCJnu BNrrN9xckQ+3xxr2Y/U1JnFnaQ5suelKpK0hmD1kth3Sfitcs8H5kYkR3kgVhh3ef079 av+NRzoMBhD40FeQM03JjDq3Z+f4TivfW00EHveNvVV3kZEt88O/dEKcDggQohP7zFq+ WzTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PjVbUxYl; 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 m10sor1666766pjv.17.2020.02.24.21.08.57 for (Google Transport Security); Mon, 24 Feb 2020 21:08:57 -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=PjVbUxYl; 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=vs2A4Za3pdSHZq6f79ZL4a42P4ysEMl/Adkkn+cV4Fo=; b=PjVbUxYl+hzlQEyEE/+DB53B78mYOsBa4d+R7HXKHucgElknJuPi8+O2ymUo5woKmw X9b28lQAtJNLxeLLU6jP+C7LUH7J+tLG0wxDm9jCrqAOIEb/WimLugq09G7kZKBkSKgT KeC9j6XeAuTz5pHC3pjH03DJSsL7O9oyIQSvGO/Xh1Olwev/DvbPvYPr6DjUVUdNaTKs epV8gLOG0i1gSqruvRfwloVvoB+I9RTCFgPgAGZS0dPZOKM1WkYeGDTgs4hPER8EfSxj gH8DHV/RPxDFNZ5dfOdbO5BDNiLNpcKzdGA/F5KxXlGxAWV2HLE5XwR4avjuJUOkBCf1 H7dw== 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=vs2A4Za3pdSHZq6f79ZL4a42P4ysEMl/Adkkn+cV4Fo=; b=AMWw+uLlw9Sr6SvCflTlaMJ1XaNPixKjqT/2VjTdSeyqRIi+GSvLNvnq6J63iF3TIS BOFO7KOSU2+uyHe7llJ53JwX6WQLvhsoGvqQFtoq0AOnTQqzSCt5UwHafFNM5EIXZJBg XiYG9vvbj8VXyV20R3YerekHBrFwfTR0BeKCYzkUPEr2mm+95LQvPktpKFY6SBQxDWCt wSSUXIFxEgmvwKIse+ZWzplJHw/aljZYcfgWkEHeeUHCGfWtFcd78qfE+0/ujQZQt0pW 7pQAIZqhHeTt9oHiksbGd+eLm3ky89B3NcMAwu/Y13Z0G9RtSE4BTYp+C/j3uoLIpLPa +T4w== X-Gm-Message-State: APjAAAW0XYcXyxNGH5ca8DhFMW4ld7o41gIAxCwBqiqkH0qHjyVo8sPu 6kkrvS6w5EAO6V+EZJCcCAYBRQnl X-Google-Smtp-Source: APXvYqxWpmh6vnDqtiwV0kaQCSFa+mczFvYM+vPDL+J9/4sdKTBHrQa7W6/PV/8V+Vj2QOhZD+RVeg== X-Received: by 2002:a17:90a:1f8c:: with SMTP id x12mr3170349pja.27.1582607337454; Mon, 24 Feb 2020 21:08:57 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:56 -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 , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 6/6] regulator: Use driver_deferred_probe_timeout for regulator_init_complete_work Date: Tue, 25 Feb 2020 05:08:28 +0000 Message-Id: <20200225050828.56458-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-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 for the delay value if it is set (using a delay of 0 if it is not). Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Saravana Kannan 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 --- v4: * Split out into its own patch, as suggested by Mark v5: * Try to simplify the logic a touch as suggested by Bjorn --- 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..51b6a2dea717 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5757,6 +5757,10 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work, static int __init regulator_init_complete(void) { + int delay = driver_deferred_probe_timeout; + + if (delay < 0) + delay = 0; /* * Since DT doesn't provide an idiomatic mechanism for * enabling full constraints and since it's much more natural @@ -5767,18 +5771,17 @@ 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)); + schedule_delayed_work(®ulator_init_complete_work, delay * HZ); return 0; }