Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp95365ybb; Fri, 27 Mar 2020 16:57:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuEP3JMmMjqqRJn3BhqisC2eiH9xWdCQGtBLpX2r/s0GgcHclYwRRHm7wf6YC70vuy8Sbx/ X-Received: by 2002:a9d:65c4:: with SMTP id z4mr952701oth.51.1585353424495; Fri, 27 Mar 2020 16:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585353424; cv=none; d=google.com; s=arc-20160816; b=0F4hDipdOePxA5znTtcSKiTYEkFZCMM5Ck1kw9Vv0xC26VZjCGNMjGxx5l92ts7oao 6vr3cxWVo+GeIjeRFwGyKJM6PaElSYdaO7B3WdRFbz51Hn89vVDpKLIhLrGOOWrnFjMX tP9/09S8EHALAjlwy1LBf0qDFAQfbYNbOkaaW7G4xNeBpJr1ADCLmJTjQNxFSoGfvPcm zXa+nR0jGzidD/e7FommQL9v3y9Ir5AiolVhYs1LapuNFB8Kbugr803TM6xXe7dqyTwp S9sDEPOl6xMQwqRdznnXIW7J1YWHU8xR26ZgMAGbZBnLRgNtEviCo/3n7UqtAyOR/DSa 7xww== 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 :in-reply-to:references:mime-version:dkim-signature; bh=K0NZbCLQ3EXESvGxt7BooZUrPODG0bjvoacB9E61EEM=; b=QWp136FN50SPzh8YMAAIDpJ0cYw3jh7pckb4tqhEeD+QaT4iuST2SUIR3MLbsciaTg R4etgwukhuggJ6qzuHRM28d4tALG3+HqCA8DHIt/0uab+ME4sNmrhf1ZenBQeBxbuqZT scxVcN3F4eZv2F1RsfRL9S3WcUqQbzFDeEzYG075ha6kt3gt70ZQXtBdIYDt1p/DkufB ebfLZzdTVdgG90niE1GZsL14v39ocF/jmELUjURjvqZN2Jd1p7pJh9oef7FgbTbBHz6V tc+4hkJWIm7qDQpOXBmk6Fr3NvxGeIIo1V+OrUjH8mU1Fnhfxkz8OVDnmHZ2V1DLS3JT JXiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XurJei6Y; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y139si3136222ooa.14.2020.03.27.16.56.49; Fri, 27 Mar 2020 16:57:04 -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=@google.com header.s=20161025 header.b=XurJei6Y; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbgC0X4L (ORCPT + 99 others); Fri, 27 Mar 2020 19:56:11 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:34870 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbgC0X4L (ORCPT ); Fri, 27 Mar 2020 19:56:11 -0400 Received: by mail-ot1-f65.google.com with SMTP id v2so7112256oto.2 for ; Fri, 27 Mar 2020 16:56:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=K0NZbCLQ3EXESvGxt7BooZUrPODG0bjvoacB9E61EEM=; b=XurJei6Y0zK73hOuGlwQ5mXHRF0bCiHRG6oKmYdCjlws+X/5KoM9fDGdLuEEL5nngn /T94i7uCchViIvOMy3pUWqFsU6MyiWxQMJqkkYxOfcAa6Pez0iNRZP9a8UNG4KrQUQSc wWxmaPyr8eDYV5niFJGTjV+W6mUa9Szj3OZ9KDoHLRDo5P2OI9GY5yUuc1rBTGX5SRZp 8dD++OkavrllEVjwGwV/NXLnWhmnfKlTxJ7By2Rl+Zyctfpdz/YCI8beVj474am+z4Ar GRWq2yI/rKZKnRVyz2tYFsCC4AKmpZnAioCE+t3sHDINPDVgLWtObc0qhWhJHliaB1cy 4Jkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=K0NZbCLQ3EXESvGxt7BooZUrPODG0bjvoacB9E61EEM=; b=h4EUPrEjxnGxYXAGldI4ckaWN6EhljaITXVTyaKligeHY1sS9/MTF/SFfurDufrT7Y 13eh0pSZ2I3a/ROXR+v5tQw6lNRByTrw+IXBko4hnFA8Ousns4FXx3mvzKQf03SDq5mL b9ieiu6YMDTc5c8LETFnF10j0WGgW07HbGihxqDPR+B0XGdGToUK21WHIsxFCQlIzjdN rpCTpAYwJWJMPVHh8EiJO3qK+sId3q3KHZKipWtUny4OLz05WKxbO8xxgBzUoINTMxfs w0mbhj+URzr7ARK2wKoz9xaBCnIs3Lp+HX54813Jhi1orwOYEHMK2SBBtJuOgC02nRK8 6Fzg== X-Gm-Message-State: ANhLgQ3kYIP9dl1uXPPKszTJOSQ7A+uo07AzzbZYgpPJhIYlK4by3HHg H8jspN4v/Ccxw/o7PCFDnkynDv1fx5ZX6zHHhWuX/A== X-Received: by 2002:a9d:42f:: with SMTP id 44mr959944otc.236.1585353370394; Fri, 27 Mar 2020 16:56:10 -0700 (PDT) MIME-Version: 1.0 References: <20200327170132.17275-1-grant.likely@arm.com> <2885b440-77a5-f2be-7524-d5fba2b0c08a@arm.com> In-Reply-To: <2885b440-77a5-f2be-7524-d5fba2b0c08a@arm.com> From: Saravana Kannan Date: Fri, 27 Mar 2020 16:55:34 -0700 Message-ID: Subject: Re: [PATCH] Add documentation on meaning of -EPROBE_DEFER To: Grant Likely Cc: Linux Doc Mailing List , LKML , nd@arm.com, Jonathan Corbet , Greg Kroah-Hartman , Andy Shevchenko 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 Fri, Mar 27, 2020 at 4:25 PM Grant Likely wrote: > > > > On 27/03/2020 18:10, Saravana Kannan wrote: > > On Fri, Mar 27, 2020 at 10:01 AM 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 > >> > >> 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. > > > > The infinite loop is a current implementation behavior. Not an > > intentional choice. So, maybe we can say the behavior is undefined > > instead? > > If you feel strongly about it, but I don't have any problem with > documenting it as the current implementation behaviour, and then > changing the text if that ever changes. Assuming Greg is okay with this doc update, I'm kinda leaning towards "undefined" because if documented as "infinite loop" people might be hesitant towards removing that behavior. But I'll let Greg make the final call. Not going to NACK for this point. -Saravana