Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3555426ybb; Tue, 31 Mar 2020 07:34:48 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtQ7R+T23W8BVDtln8h8UbeXeDKfuJCXY7UBD0IEwLmEgcvoQiCycrrH/auxwSuCNNJo4Ww X-Received: by 2002:a4a:6841:: with SMTP id a1mr3300546oof.18.1585665288524; Tue, 31 Mar 2020 07:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585665288; cv=none; d=google.com; s=arc-20160816; b=O98HYgZWICxwPHdMV0pNGGrGlsXPFzxubmiQaIXLJ00PDlrgSyUpv11Nwe1zWZBQtt 2AdMyxmgchvZYlN6uz563Pmda4SdYIzFmfMd6F8vDsQmaEbn40i6rC0WfT85Sdew1mWp tlfuxeVrb+S+1pZ+A1iUdz79s6WS84isjIhlRDdI6GTDQzXq9y2IYqXf9hgnsA0e+jBw mosBX4/XRUZ/TzekZo0FcPb2OnNcOxu2/klGE2tVt0bNkqhBwEL/Vc+ataitbKYTup9y AyFz94vvXVYezI1/YmGT+hzZoG/Sivy9An/47/qtrd/PgJXcT6ymyk5x5oah2E0PbEuy Ldyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=AT0iak7bd/34NEYB5sotP/1Et/9sAlO2Rw7hrj4vVRk=; b=PkiayslSjhYcwny+DG9WFsvXN+2h/yXsgPlu5nqTS6YnEskYtpcGmq01g8g5nO3/j8 jdcxJwO8k4lgLFfF0Vp/LkQLOU2rw3q6CsB+Q0+IwSVTQYVRGAOTrVYvgyMc9CBKTobY k8ampw9R2kc/lkI+DzvEEMDBRmlw1SdoXUIllvVE6lkhkOHURAihK9KB4yunUD3Zi1ra 56EdhQdEay7hShLhgxc+oXXS5CzNFx70r3+LS0fJPXwbnVAULK5rQpHyfBOmvE6BbyKG 5veE0WLdPKDJXS9R9alzdEwNTY6fSk/x1Hc+0EWozIaX4s8sc43gSQQRiYNk1tkQA/Wm A8uQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si7390086ooq.78.2020.03.31.07.34.32; Tue, 31 Mar 2020 07:34:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731053AbgCaOeA (ORCPT + 99 others); Tue, 31 Mar 2020 10:34:00 -0400 Received: from mga18.intel.com ([134.134.136.126]:64552 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730845AbgCaOeA (ORCPT ); Tue, 31 Mar 2020 10:34:00 -0400 IronPort-SDR: B9PYXwznGP3Hj+nnOhmMo+nJ/DlhzNVOcnZzOLUdO08DBzrOZYOFPDeQWXlbZ8UL/QoAueLe40 vXdgVmi7KeaA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 07:33:55 -0700 IronPort-SDR: PoVz2pXBjVTUT9DlfTQYcfPUohGMn5hhvWqYZhmscH6zT9y0UxtuZRV7CvcbhfJsLoPX88lsrR 8TDSbWmn+l9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,328,1580803200"; d="scan'208";a="450183284" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga006.fm.intel.com with ESMTP; 31 Mar 2020 07:33:53 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jJHxj-00EWXQ-VY; Tue, 31 Mar 2020 17:33:55 +0300 Date: Tue, 31 Mar 2020 17:33:55 +0300 From: Andy Shevchenko To: Grant Likely Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, nd@arm.com, Jonathan Corbet , Greg Kroah-Hartman , Saravana Kannan Subject: Re: [PATCH] Add documentation on meaning of -EPROBE_DEFER Message-ID: <20200331143355.GP1922688@smile.fi.intel.com> References: <20200327170132.17275-1-grant.likely@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200327170132.17275-1-grant.likely@arm.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2020 at 05:01:32PM +0000, Grant Likely wrote: > Add a bit of documentation on what it means when a driver .probe() hook > returns the -EPROBE_DEFER error code, including the limitation that > -EPROBE_DEFER should be returned as early as possible, before the driver > starts to register child devices. > > Also: minor markup fixes in the same file Greg, can we at least for time being have this documented, means applied? FWIW, Reviewed-by: Andy Shevchenko > Signed-off-by: Grant Likely > Cc: Jonathan Corbet > Cc: Greg Kroah-Hartman > Cc: Saravana Kannan > Cc: Andy Shevchenko > --- > .../driver-api/driver-model/driver.rst | 32 ++++++++++++++++--- > 1 file changed, 27 insertions(+), 5 deletions(-) > > diff --git a/Documentation/driver-api/driver-model/driver.rst b/Documentation/driver-api/driver-model/driver.rst > index baa6a85c8287..63057d9bc8a6 100644 > --- a/Documentation/driver-api/driver-model/driver.rst > +++ b/Documentation/driver-api/driver-model/driver.rst > @@ -4,7 +4,6 @@ Device Drivers > > See the kerneldoc for the struct device_driver. > > - > Allocation > ~~~~~~~~~~ > > @@ -167,9 +166,26 @@ the driver to that device. > > A driver's probe() may return a negative errno value to indicate that > the driver did not bind to this device, in which case it should have > -released all resources it allocated:: > +released all resources it allocated. > + > +Optionally, probe() may return -EPROBE_DEFER if the driver depends on > +resources that are not yet available (e.g., supplied by a driver that > +hasn't initialized yet). The driver core will put the device onto the > +deferred probe list and will try to call it again later. If a driver > +must defer, it should return -EPROBE_DEFER as early as possible to > +reduce the amount of time spent on setup work that will need to be > +unwound and reexecuted at a later time. > + > +.. warning:: > + -EPROBE_DEFER must not be returned if probe() has already created > + child devices, even if those child devices are removed again > + in a cleanup path. If -EPROBE_DEFER is returned after a child > + device has been registered, it may result in an infinite loop of > + .probe() calls to the same driver. > + > +:: > > - void (*sync_state)(struct device *dev); > + void (*sync_state) (struct device *dev); > > sync_state is called only once for a device. It's called when all the consumer > devices of the device have successfully probed. The list of consumers of the > @@ -212,6 +228,8 @@ over management of devices from the bootloader, the usage of sync_state() is > not restricted to that. Use it whenever it makes sense to take an action after > all the consumers of a device have probed. > > +:: > + > int (*remove) (struct device *dev); > > remove is called to unbind a driver from a device. This may be > @@ -224,11 +242,15 @@ not. It should free any resources allocated specifically for the > device; i.e. anything in the device's driver_data field. > > If the device is still present, it should quiesce the device and place > -it into a supported low-power state:: > +it into a supported low-power state. > + > +:: > > int (*suspend) (struct device *dev, pm_message_t state); > > -suspend is called to put the device in a low power state:: > +suspend is called to put the device in a low power state. > + > +:: > > int (*resume) (struct device *dev); > > -- > 2.20.1 > -- With Best Regards, Andy Shevchenko