[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190614143636.GB11550@kroah.com>
Date: Fri, 14 Jun 2019 16:36:36 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Thierry Reding <thierry.reding@...il.com>,
Kevin Hilman <khilman@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Joerg Roedel <joro@...tes.org>,
Linus Walleij <linus.walleij@...aro.org>,
Rob Herring <robh@...nel.org>,
Linux PM <linux-pm@...r.kernel.org>,
linux-gpio@...r.kernel.org,
"open list:AMD IOMMU (AMD-VI)" <iommu@...ts.linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] driver: core: Allow subsystems to continue deferring
probe
On Fri, Jun 14, 2019 at 12:10:10PM +0200, Rafael J. Wysocki wrote:
> On Fri, Jun 14, 2019 at 11:39 AM Thierry Reding
> <thierry.reding@...il.com> wrote:
> >
> > On Fri, Jun 14, 2019 at 11:10:58AM +0200, Greg Kroah-Hartman wrote:
> > > On Thu, Jun 13, 2019 at 07:00:11PM +0200, Thierry Reding wrote:
> > > > From: Thierry Reding <treding@...dia.com>
> > > >
>
> [cut]
>
> >
> > To avoid further back and forth, what exactly is it that you would have
> > me do? That is, what do you consider to be the correct way to do this?
> >
> > Would you prefer me to add another function with a different name that
> > reimplements the functionality only with the exception? Something along
> > the lines of:
> >
> > int driver_deferred_probe_check_state_continue(struct device *dev)
> > {
> > int ret;
> >
> > ret = driver_deferred_probe_check_state(dev);
> > if (ret == -ENODEV)
> > return -EPROBE_DEFER;
> >
> > return ret;
> > }
> >
> > ? I'd need to split that up some more to avoid the warning that the
> > inner function prints before returning -ENODEV, but that's a minor
> > detail. Would that API be more to your liking?
>
> Well, why don't you do
>
> static int deferred_probe_check_state_internal(struct device *dev)
> {
> if (!initcalls_done)
> return -EPROBE_DEFER;
>
> if (!deferred_probe_timeout) {
> dev_WARN(dev, "deferred probe timeout, ignoring dependency");
> return -ETIMEDOUT;
> }
>
> return 0;
> }
>
> int driver_deferred_probe_check_state(struct device *dev)
> {
> int ret = deferred_probe_check_state_internal(dev);
>
> if (ret)
> return ret;
>
> dev_warn(dev, "ignoring dependency for device, assuming no driver");
> return -ENODEV;
> }
>
> int driver_deferred_probe_check_state_continue(struct device *dev)
> {
> int ret = deferred_probe_check_state_internal(dev);
>
> if (ret)
> return ret;
>
> return -EPROBE_DEFER;
> }
Yes, that's much more sane. Self-decribing apis are the key here, I did
not want a boolean flag, or any other flag, as part of the public api as
they do not describe what the call does at all.
thanks,
greg k-h
Powered by blists - more mailing lists