Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2951812imm; Thu, 24 May 2018 19:45:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqrb1ToSjnvLLrAAQ/ytsL0AvHVWU57Rt7yZQhr9fsOVvZn+0wGJqq/5/JvWlZ7HoNqkIhT X-Received: by 2002:a17:902:125:: with SMTP id 34-v6mr669756plb.42.1527216355565; Thu, 24 May 2018 19:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216355; cv=none; d=google.com; s=arc-20160816; b=h90rceL1P97cjw7Jz0P1Z03C/ZhcQQCQWv4RSsjdwIMpGi2aTirIl+bXxlcRB403p/ qppuMMeCCuphphz6Wj9/j08pziGBQ2xrjsYa60XFyGCzRwXU/bhbdCDzlwF/xL6ToW3C XWtevXVtYHZL13yJptiw+IVZP5/8dZHOzkn1ZdMT6MGEZHrw3veTGoxfGmQo52XX7/Ts nEXhrD2ce0HbH4BCq8iBTrgHFHqA/ktWwfjFrTSPh2P5EWd0yBztFOzqy8EgBk6tekj3 Wx7xDAvhG1cP7GgbL0QlCB4gl7GHkjynQrVmIcateOMNFokYNdiVJ5MrCWB1iOAHSdK7 9k5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=AstqbaZd1EtR9lf10vzmk2+tQgPCBFvMwRFRP/CNCi4=; b=r2srjD4vqllyweCAShnnmj2FtKsvuIOeSshjYcbRJVIAOaK2iO2hWEE6La4GAs1HM8 qOazgOLCe08f4KtKhHf2C5wpf8OS+d/URRFDEWikPNczI78zpsP1wskDDNRTg8wV8CJ7 ZV+wyEbkIDzVBqYnjW26wCO+4SSx3oqCrqSN/eRWzaBnakTgcHFtoXeQk1POywL6jn/B JNl0MEMEv7j11TgLECN3v0smKhwoQxk4KKL05fkVrxfVdwW/l7QNemelpmeTQqEX5/aT RoyhSDzRIoQCL5sz+yxF71PKHNWh6sMwGgWW3QkLJSIkCyxZG1SAlzOjIlKhc8EblCUr ojNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ePe3mJSU; 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 i64-v6si22625205pli.224.2018.05.24.19.45.41; Thu, 24 May 2018 19:45:55 -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=@linaro.org header.s=google header.b=ePe3mJSU; 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 S1034748AbeEXW3D (ORCPT + 99 others); Thu, 24 May 2018 18:29:03 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33553 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966228AbeEXW26 (ORCPT ); Thu, 24 May 2018 18:28:58 -0400 Received: by mail-pl0-f68.google.com with SMTP id n10-v6so1896872plp.0 for ; Thu, 24 May 2018 15:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AstqbaZd1EtR9lf10vzmk2+tQgPCBFvMwRFRP/CNCi4=; b=ePe3mJSU7BkkUF91icXVOdcxNaWhCxoI6q4Kmh4zi3KYkc1m6l691t/GgLSwF5hNe+ Kvk5pOfT6SDuAoIc6e7+wqqq00TbisfvwOJ6CWwWYceYfdHL1X4i0fysvRDdPcameRai 0af5lKB5wdBEuoStelZQIbPoT9OogunkqDsBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AstqbaZd1EtR9lf10vzmk2+tQgPCBFvMwRFRP/CNCi4=; b=ic5DodjnzaAETu1ickTRuMeUWfM24cwdmRClXwQ0cgUHVVshFQ/7y1u4H9PrHprAXW cYdwMktF5fTML3OC0okKAOK6cY4xA8651jMZL16qN5p7vZrEO8bfW0LDU38nMHCB565T zhEdufzmksZF39mHtVPbtScHhDMm7wuJ3aYM4GCW1qZEaGAXN3I6Nt4h2s2hFnryO3OD bdv/75tAhyaG1GqiSxjSFaTrnYK/cqf0BCa0HZwC5Q3xrg6XejRTkkvoNIkiZ2/njwZM f1x3dzyqHTyctor19xshIBMjd/B6vl6rmZuitoL90a42HUotQlE5/+jMDm8rdputNxgn 7YoQ== X-Gm-Message-State: ALKqPweBiICiTE4Afo2ccXPbNIzyJvhNNPgh9fyRMF07CF3GU8qRl7w+ m6mLdpcflDV9gLYhaCWuHHdPqg== X-Received: by 2002:a17:902:7c86:: with SMTP id y6-v6mr5383376pll.138.1527200938278; Thu, 24 May 2018 15:28:58 -0700 (PDT) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id d15-v6sm40054022pfh.97.2018.05.24.15.28.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 15:28:57 -0700 (PDT) Date: Thu, 24 May 2018 15:28:55 -0700 From: Bjorn Andersson To: Rob Herring , Arnd Bergmann Cc: Greg Kroah-Hartman , Linus Walleij , Alexander Graf , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Joerg Roedel , Robin Murphy , Mark Brown , Frank Rowand , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, boot-architecture@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/8] driver core: make deferring probe after init optional Message-ID: <20180524222855.GD14924@minitux> References: <20180524175024.19874-1-robh@kernel.org> <20180524175024.19874-2-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180524175024.19874-2-robh@kernel.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 24 May 10:50 PDT 2018, 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. > For builtin drivers this still looks reasonable. But I would like to have an additional clarification here stating that drivers that might be targeted by this query must not be compiled as modules. And I would prefer to see an ack from e.g. Arnd that arm-soc is okay that we drop "tristate" on drivers affected by this; e.g. if we put this in the pinctrl core then all pinctrl drivers should be "bool" and so should any i2c, ssbi and spmi buses and drivers be. Regards, Bjorn > 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) { > + dev_WARN(dev, "ignoring dependency for device, assuming no driver"); > + return -ENODEV; > + } > + > + return -EPROBE_DEFER; > +} > + > /** > * deferred_probe_initcall() - Enable probing of deferred devices > * > @@ -240,6 +250,13 @@ static int deferred_probe_initcall(void) > /* Sort as many dependencies as possible before exiting initcalls */ > flush_work(&deferred_probe_work); > initcalls_done = true; > + > + /* > + * Trigger deferred probe again, this time we won't defer anything > + * that is optional > + */ > + driver_deferred_probe_trigger(); > + flush_work(&deferred_probe_work); > return 0; > } > late_initcall(deferred_probe_initcall); > diff --git a/include/linux/device.h b/include/linux/device.h > index 477956990f5e..f3dafd44c285 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -334,6 +334,8 @@ struct device *driver_find_device(struct device_driver *drv, > struct device *start, void *data, > int (*match)(struct device *dev, void *data)); > > +int driver_deferred_probe_check_init_done(struct device *dev, bool optional); > + > /** > * struct subsys_interface - interfaces to device functions > * @name: name of the device function > -- > 2.17.0 >