From patchwork Fri Feb 14 23:32: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: 183527 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2385521ile; Fri, 14 Feb 2020 15:32:32 -0800 (PST) X-Received: by 2002:a63:4e63:: with SMTP id o35mr5693060pgl.279.1581723152305; Fri, 14 Feb 2020 15:32:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581723152; cv=none; d=google.com; s=arc-20160816; b=IQPx7zZLrj+vK7TXp81qm8FBnYhKZS1GPoFYkJzG8oEjlgU5HbleXbiJJtEQjNj1S/ mrV27/iGU3TTGsEAt2dalUdN87TKDh60ACJqnTohfX/hfIq883ThAr/uNrXmH7I5sWxz 8Lyje5UvuVJMngQxu/RWKtbvHiDcvdee0s4JnMJh62VnhakDFjG7Qz8oI9fBPT16sDSd LN8DmGt4Tl8kmknEN+lMeA8aM1S04hJBM0RiYFmDcz9aNyXvlzZ0KkMcBgbE29mZViT0 ZE2MWbzrA1uFI60NUf0+VqAC+vsQBXRffCuzCTtogQP0Cipmygz9nIyw7qxeP0+tlNLG 7vsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=AEe1XGyTWqkzhlgRgpYtuBl1Yjp3hmm+kvRYMs3wUvI=; b=MqjSMzLdaw7SyqDJ38msiTvadY3FJNZrBi0tVH9pqykBGh/N4+G4ETyuGPkFNJ1Y4P m1MdHP0BRyNCjA7PuSrdEMM58vObfIUJMjEv6o7Hy4qTHox3kVN5i65QhVQlTog2XxJo RfRMlXgS4rrPbZitPZGdIie30/Oe/S/tT3xGZpUlKhBn7Ay0rvNwp7MpQ6Jt9h6TDA6Y PIGxnkLb2awhh3hxSlvot6hvm78/hGPfSo3lOKYtLSUhQCARE8U/LyRuP632Hh0KmtVG mbnAN/1KebdbpIW/yPcdzOGTh52gtHd6/MEP9Cbl1DTZg1C6UCKOR+iJyBJrRtWG8axH sRyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EkJxDj2m; 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 w16sor8647786pgi.49.2020.02.14.15.32.32 for (Google Transport Security); Fri, 14 Feb 2020 15:32:32 -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=EkJxDj2m; 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; bh=AEe1XGyTWqkzhlgRgpYtuBl1Yjp3hmm+kvRYMs3wUvI=; b=EkJxDj2mwMx8wX8lW1XNriMQ9dQgixwTl+SgJLSFykIMCJfld/jkqDJvmdh3e+phRd D1U8AyXTN9kM7Y8TUjYPDxDYUfnz3nWAdNh1+fAs8jye/mNN2AhFMdd+V9buD7wei9Ru oeO/l5QJHhRD/leFqBO0fYZigih9psvg/4LIMuBiiKVxKfqzQtsyV3uoO9bHZRsSaIwZ whj4LStOg5tGpEl/Pd3nVXGv13x00suiNECZnLuOoLhHZhtt08FfanM2eOqEe8qt5EVa DLSi6rOL3QZJb+sb2OqrsCJQHV4Gf15WJwJwNT6JM/Xt143CUEqeXIT3RRwTf6LslRGO goIA== 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; bh=AEe1XGyTWqkzhlgRgpYtuBl1Yjp3hmm+kvRYMs3wUvI=; b=Eydgmah55U1x+24DfqXn8FZo4E7vlcW9OD8shtRhfVvnOrPuyxEk7pS8cUN3/XCehX Nyf2ldBvWjLJxWDEU3QV217Vy0/4Z1Kk6Qrj3AxlC8bzFRzlBK3BL3dFiHXrqfLxp2OU kFk8aSwLzxgOy1FPJo8cI+WTPEi1g0diyNT6JWUmJ7C5D2FSPk8Iy9X1S4ZaweYMRUdq EyDiUuwUXIj6V6couSIaZ/6Yl7r2j2js9L0+LL0/orE+kwn3mtzmK5SpvKx/0LQjdszj Kaz/I/l+i0rdkyEzpaH3wtdxaQPMURb0LEUdLRYx0zT5PJtr6by8/6VWBgziHCEMmnrH 3wUg== X-Gm-Message-State: APjAAAXi8JXHfkd1p6lqLRlSG20slZm1x8SpNFCnWgRmlI+IW1UR4fHV V8Pzg02qY8U2fXMwhFbevST2f+GP X-Google-Smtp-Source: APXvYqzgBII0sPALArT4QCNkYh1u20q+JC7yfNO/Gi6+mOWOSy+wsplpo6Z8vkCPl9zmgRj3oAGlHA== X-Received: by 2002:a63:5a65:: with SMTP id k37mr6172994pgm.264.1581723151766; Fri, 14 Feb 2020 15:32:31 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id t186sm8596702pgd.26.2020.02.14.15.32.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 15:32:31 -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 , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v2] driver core: Extend returning EPROBE_DEFER for two minutes after late_initcall Date: Fri, 14 Feb 2020 23:32:26 +0000 Message-Id: <20200214233226.82096-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 Due to commit e01afc3250255 ("PM / Domains: Stop deferring probe at the end of initcall"), along with commit 25b4e70dcce9 ("driver core: allow stopping deferred probe after init") after late_initcall, drivers will stop getting EPROBE_DEFER, and instead see an error causing the driver to fail to load. That change causes trouble when trying to use many clk drivers as modules, as the clk modules may not load until much later after init has started. If a dependent driver loads and gets an error instead of EPROBE_DEFER, it won't try to reload later when the dependency is met, and will thus fail to load. Instead of reverting that patch, this patch tries to extend the time that EPROBE_DEFER is retruned by 30 seconds, to (hopefully) ensure that everything has had a chance to load. 30 seconds was chosen to match the similar timeout used by the regulator code here in commit 55576cf18537 ("regulator: Defer init completion for a while after late_initcall") Specifically, on db845c, this change allows us to set SDM_GPUCC_845, QCOM_CLK_RPMH and COMMON_CLK_QCOM as modules and get a working system, where as without it the display will fail to load. 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: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Fixes: e01afc3250255 ("PM / Domains: Stop deferring probe at the end of initcall") Fixes: 25b4e70dcce9 ("driver core: allow stopping deferred probe after init") Signed-off-by: John Stultz --- v2: * Add calls to driver_deferred_probe_trigger() after the two minute timeout, as suggested by Bjorn * Minor whitespace cleanups * Switch to 30 second timeout to match what the regulator code is doing as suggested by Rob. --- drivers/base/dd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index d811e60610d3..0f519ef3b257 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -311,6 +311,15 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) } static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); +static void deferred_initcall_done_work_func(struct work_struct *work) +{ + initcalls_done = true; + driver_deferred_probe_trigger(); + flush_work(&deferred_probe_work); +} +static DECLARE_DELAYED_WORK(deferred_initcall_done_work, + deferred_initcall_done_work_func); + /** * deferred_probe_initcall() - Enable probing of deferred devices * @@ -327,7 +336,8 @@ static int deferred_probe_initcall(void) driver_deferred_probe_trigger(); /* Sort as many dependencies as possible before exiting initcalls */ flush_work(&deferred_probe_work); - initcalls_done = true; + schedule_delayed_work(&deferred_initcall_done_work, + msecs_to_jiffies(30000)); /* * Trigger deferred probe again, this time we won't defer anything