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