Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2950524imm; Thu, 24 May 2018 19:44:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpIRbfsNs03hSvIVo0TtQns6wi92MKj6RfdVFZkYABKlS1tb+AhOdHS6keSVNVnf5Ntz6nw X-Received: by 2002:a17:902:bb84:: with SMTP id m4-v6mr589307pls.339.1527216263462; Thu, 24 May 2018 19:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216263; cv=none; d=google.com; s=arc-20160816; b=kNXeQhWuC/+ucfpV9J8rY8TP8pz9qKExRqQTcFHKhSi6uRJG5T0fT3DJRhjAZw3FCy Ewey9Fl6HzO+mJj2jmXi6jNJda/F00homqTkcxYHGy9cKd9Rjd1TVjHq/SASdrTM4ZEm jyn6T3xos9eJ0CNwBBp2L3pY0daBqI53BdYrUuByFPeSIAuQz1+PZOHZEs/vpOpQrIVq bG6kmsPkQdVHiDQXz87hRWrkGh30uXIFM42NC85ib9nGiebyEWrb2hd3GvhYllF19TKp k/Mrowx/eDEwKJ/TekBjlpA+AdEEuV0W9JRukVGPC1VDzApV4cyUszg4HbmeAvhtYiGt +aFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=8j7o1oNnUyX25iQlPKP6oBn5f9enOFhltovzzYnhIYw=; b=Vb8H4vpQ7z+9Yb2K99lCFvXPaBKGvn1B8At+rIGxRhjKeb0ByCUXNOZSB3WD/OwYN8 lleUT5IB1WN1alYf+VQg82AV31reUjO8dwc+/4blrWldfuHaojRA30Ig163DJL2RJ/82 I3PyW5Wt7EY1B2kC/+7nz4XwI5etGlPpuE08lYSOnz+wXjZcFSgVI6+j8t+H36s1HzcZ AS5z3ZPcqz3iuhab/Ig6O5yeC+vFX4+6f8QUcmd6TF6nKzxM71tnq/B6YrvlAKdiG/S5 F+uU4rM3mvs29B/dqkOn9u9XZPAx0yyNXVCE4sjMIzMhUrASR0ePw+jlObZIkJo3tXgo w8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TaC/a8kD; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a185-v6si17560131pgc.586.2018.05.24.19.44.09; Thu, 24 May 2018 19:44:23 -0700 (PDT) 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=@kernel.org header.s=default header.b=TaC/a8kD; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S971537AbeEXU6S (ORCPT + 99 others); Thu, 24 May 2018 16:58:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:39596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969064AbeEXU6Q (ORCPT ); Thu, 24 May 2018 16:58:16 -0400 Received: from mail-qk0-f182.google.com (mail-qk0-f182.google.com [209.85.220.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3A53120892; Thu, 24 May 2018 20:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527195496; bh=mXe2ZIetXFOvaWA7PWw4uBPqTOZf/b9UwMiAAiN9wz8=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=TaC/a8kDio9l21IDBTTxm549Bl+FrzVYAk+dtjCfy2HZ9j0na3qBrenmQnLnq6nH0 X92UL3+1V3f44zxYUXd4BKs+FmHjpb3YGcS+zrgpjPkPhmBDXIL7/tGYgeg6PsxTMG yQDK+TPAsQ1maF8f5QQ2xiaMVbvRVkRjvY6b+tTI= Received: by mail-qk0-f182.google.com with SMTP id h140-v6so2460436qke.2; Thu, 24 May 2018 13:58:16 -0700 (PDT) X-Gm-Message-State: ALKqPwffw4LFcfUR+PRTWx29oxR/plO83G5QQw1Lgt0krdhAqMWwHGWZ Joj06ys1FhhqhrP55ge51VqGYOL56YUMymjiKw== X-Received: by 2002:a37:d7cf:: with SMTP id t76-v6mr3480055qkt.96.1527195495292; Thu, 24 May 2018 13:58:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9b02:0:0:0:0:0 with HTTP; Thu, 24 May 2018 13:57:54 -0700 (PDT) In-Reply-To: <20180524190031.GB31019@kroah.com> References: <20180524175024.19874-1-robh@kernel.org> <20180524175024.19874-2-robh@kernel.org> <20180524190031.GB31019@kroah.com> From: Rob Herring Date: Thu, 24 May 2018 15:57:54 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/8] driver core: make deferring probe after init optional To: Greg Kroah-Hartman Cc: Linus Walleij , Alexander Graf , Bjorn Andersson , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Joerg Roedel , Robin Murphy , Mark Brown , Frank Rowand , "linux-kernel@vger.kernel.org" , devicetree@vger.kernel.org, Architecture Mailman List , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 24, 2018 at 2:00 PM, Greg Kroah-Hartman wrote: > On Thu, May 24, 2018 at 12:50:17PM -0500, Rob Herring wrote: >> Deferred probe will currently wait forever on dependent devices to probe, >> but sometimes a driver will never exist. It's also not always critical for >> a driver to exist. Platforms can rely on default configuration from the >> bootloader or reset defaults for things such as pinctrl and power domains. >> This is often the case with initial platform support until various drivers >> get enabled. There's at least 2 scenarios where deferred probe can render >> a platform broken. Both involve using a DT which has more devices and >> dependencies than the kernel supports. The 1st case is a driver may be >> disabled in the kernel config. The 2nd case is the kernel version may >> simply not have the dependent driver. This can happen if using a newer DT >> (provided by firmware perhaps) with a stable kernel version. >> >> Subsystems or drivers may opt-in to this behavior by calling >> driver_deferred_probe_check_init_done() instead of just returning >> -EPROBE_DEFER. They may use additional information from DT or kernel's >> config to decide whether to continue to defer probe or not. >> >> Cc: Alexander Graf >> Signed-off-by: Rob Herring >> --- >> drivers/base/dd.c | 17 +++++++++++++++++ >> include/linux/device.h | 2 ++ >> 2 files changed, 19 insertions(+) >> >> diff --git a/drivers/base/dd.c b/drivers/base/dd.c >> index c9f54089429b..d6034718da6f 100644 >> --- a/drivers/base/dd.c >> +++ b/drivers/base/dd.c >> @@ -226,6 +226,16 @@ void device_unblock_probing(void) >> driver_deferred_probe_trigger(); >> } >> >> +int driver_deferred_probe_check_init_done(struct device *dev, bool optional) >> +{ >> + if (optional && initcalls_done) { > > Wait, what's the "optional" mess here? My intent was that subsystems just always call this function and never return EPROBE_DEFER themselves. Then the driver core can make decisions as to what to do (such as the timeout added in the next patch). Or it can print common error/debug messages. So optional is a hint to allow subsystems per device control. > > The caller knows this value, so why do you need to even pass it in here? Because regardless of the value, we always stop deferring when/if we hit the timeout and the caller doesn't know about the timeout. If we get rid of it, we'd need functions for both init done and for deferred timeout. > And bool values that are not obvious are horrid. I had to go look this > up when reading the later patches that just passed "true" in this > variable as I had no idea what that meant. Perhaps inverting it and calling it "keep_deferring" would be better. However, the flag is ignored if we have timed out. > > So as-is, no, this isn't ok, sorry. > > And at the least, this needs some kerneldoc to explain it :) That part is easy enough to fix. Rob