Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3235358ybv; Mon, 24 Feb 2020 21:10:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxcmGnPHttDgakVRqdcs3IpmIK59RhURJd7ZYdeyxQZlk3y+5F6+6nRM/MPjxwpd3ooEkuO X-Received: by 2002:aca:d4ca:: with SMTP id l193mr2176483oig.133.1582607420392; Mon, 24 Feb 2020 21:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582607420; cv=none; d=google.com; s=arc-20160816; b=Z8DoF3hyVAzjlJaiVeKfB50lxr06XUPwCJDdnTbv+mbf5Hp4W8m/LN0Ho3NHmdGP8i 8M9Oez05E9fszHgpLJTYkGMph5XAYjjSs9hapCHV0BXF8YrKOTQ3W9a1+7ZNNUi7jdFa keUVX4dHmOvQW380KjVBw6Dr7V/gsR6MwwbXwbxa4NIDreBtoGPhlUqHamkkrsr1avny lvpToFHmxwcziD68Y9vi7kVN7RUQ4kTbhEyoPwt1CWJPnz9cFSnK2kPVnFsPZi19Y4C/ 4zcW1zlT4aSm7LoP5l0GR032BD8DQGcgeh4ISr4o0UBIBOvB6R7dAQjMeVBySboKu8Xh ImqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=vs2A4Za3pdSHZq6f79ZL4a42P4ysEMl/Adkkn+cV4Fo=; b=i68QunZVMTl2vKdFAuuTK03nfvNIeVH1KpyZ++hO9+sX1YNzZ10U6nqvyVmIKuKkQ9 OOj07fybQBDK0gf1CyxPf06ZoIUmBYI7xl7JM+lCsErdhaizW0R6nZlx740o2yV53KdS 9mfr/8v1CbPyZ8KY+VkUHW/JSHVxdrfHingSk58XfwmZ9LDD8yCmUfigO4Ng5oCj0IeT 6Bn7gjSEaTtqZ/dcO+rsd79tPSqmoQfyZ/znn87gTyEWpnBzKVAMNVeIdcMxYYyDh0y8 s0y/VvEukpC9vF4XELmWHE4FYl3wc+BKG0QDuSvHG4TR4SFQagq1srKyM2wcNOmczce3 TLoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PjVbUxYl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p23si7745466otk.119.2020.02.24.21.10.07; Mon, 24 Feb 2020 21:10:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PjVbUxYl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728999AbgBYFI7 (ORCPT + 99 others); Tue, 25 Feb 2020 00:08:59 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:37817 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728976AbgBYFI6 (ORCPT ); Tue, 25 Feb 2020 00:08:58 -0500 Received: by mail-pj1-f66.google.com with SMTP id m13so757972pjb.2 for ; Mon, 24 Feb 2020 21:08:58 -0800 (PST) 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=qVLpH6ns3tnN2maIaA5GJBEx44Ddt9s4cvHIhwUeR3dVBMpCJboq8MQ3Frq19AX8CO PJldPmgz3kG+KOoCoW5cLJOGjKA5R4lEdndyb5f4Qxfofi+Z38GPnZ0phLJv3GkVOt49 ZO1l9tA4SACqs86UfWsUPyNsFvfod2YBhuv2Wh8PN1Wk168psjUOtd7Vs232XnYhjOhN 6pW7/cqHSyoTCYepEAtbvXPX0GqaUq9K3qfiVwDI50GAfRDScV3fHJZjQQDDDUYFOyGR kmlPJiGWISkVTHSc6GnQzYSxyJudma9XkO/fvZ/0ugVjzCUEfU5ArhY483t91fJCSTQW CFYQ== X-Gm-Message-State: APjAAAX+p1t1hL4Ozgl27K5XDVcsHOITjRpTdHR4Xp/E8rY3F1BcH6Uo 0RLD9djZU3S8fthjXJjG2d/CwsvJbFI= X-Received: by 2002:a17:90a:1f8c:: with SMTP id x12mr3170349pja.27.1582607337454; Mon, 24 Feb 2020 21:08:57 -0800 (PST) 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) 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; } -- 2.17.1