linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Saravana Kannan <saravanak@google.com>
Cc: Grant Likely <grant.likely@arm.com>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>, nd <nd@arm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] Add documentation on meaning of -EPROBE_DEFER
Date: Sat, 28 Mar 2020 13:13:42 +0200	[thread overview]
Message-ID: <CAHp75VdXG2vGNp-0DLqAMx377nwyjzEt5=+Nakg4_vhaDGZB-A@mail.gmail.com> (raw)
In-Reply-To: <CAGETcx_0=W6P_Zf-6fvDfncXUrPvt31bf6de-RWwHaXtwJizmQ@mail.gmail.com>

On Sat, Mar 28, 2020 at 1:57 AM Saravana Kannan <saravanak@google.com> wrote:
> On Fri, Mar 27, 2020 at 4:25 PM Grant Likely <grant.likely@arm.com> wrote:
> > On 27/03/2020 18:10, Saravana Kannan wrote:
> > > On Fri, Mar 27, 2020 at 10:01 AM Grant Likely <grant.likely@arm.com> 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.

...

> > >> +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?

Why? *Good* documentation must describe the actual behaviour, not hide it.

> > 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"

I think it should not distort the reality.

> because if documented as "infinite loop" people might be
> hesitant towards removing that behavior.

This is funny argument. Won't we do kernel better?

>  But I'll let Greg make the
> final call. Not going to NACK for this point.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2020-03-28 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 17:01 [PATCH] Add documentation on meaning of -EPROBE_DEFER Grant Likely
2020-03-27 18:10 ` Saravana Kannan
2020-03-27 23:25   ` Grant Likely
2020-03-27 23:55     ` Saravana Kannan
2020-03-28 11:13       ` Andy Shevchenko [this message]
2020-03-28 17:03       ` Jonathan Corbet
2020-03-28 21:46         ` Saravana Kannan
2020-03-31 14:33 ` Andy Shevchenko
2020-03-31 16:43   ` Greg Kroah-Hartman
2020-03-31 17:03     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75VdXG2vGNp-0DLqAMx377nwyjzEt5=+Nakg4_vhaDGZB-A@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=grant.likely@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nd@arm.com \
    --cc=saravanak@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).