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; }