mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-m68k <linux-m68k@lists.linux-m68k.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nubus: Unconditionally register bus type
Date: Tue, 8 May 2018 17:59:52 +1000 (AEST)	[thread overview]
Message-ID: <alpine.LNX.2.21.1805081638020.30@nippy.intranet> (raw)
In-Reply-To: <CAMuHMdUCEc0n1R6-=8fcw2xng7ETPUEs86PhC_0=1jY_AYV6Bg@mail.gmail.com>

On Tue, 8 May 2018, Geert Uytterhoeven wrote:

> > This example is the sort of flag removal that I had in mind --
> >
> > diff --git a/drivers/base/driver.c b/drivers/base/driver.c
> > index ba912558a510..4ee22fb3db92 100644
> > --- a/drivers/base/driver.c
> > +++ b/drivers/base/driver.c
> > @@ -148,7 +148,8 @@ int driver_register(struct device_driver *drv)
> >         int ret;
> >         struct device_driver *other;
> >
> > -       BUG_ON(!drv->bus->p);
> > +       if (!drv->bus->p)
> > +               return -ENODEV;
> 
> If this is meant to handle the case where the device driver is registered
> before the bus is registered, while the latter can still happen later,
> then you want to return -EPROBE_DEFER.
> 

Returning -EAGAIN might be appropriate if driver_register() could 
reasonably expect the bus to come into existence.

However, a separation of concerns would seem to imply that the driver core 
has no way of knowing whether that might happen.

Anyway, this discussion is academic. The patch was only meant to 
illustrate a way to remove code instead of adding it, while achieving the 
same goal.

I'm not proposing this patch. I don't claim to understand all of the 
considerations that apply here. I'm certain there are situations where 
BUG_ON is appropriate. This may be one of those situations.

-- 

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> 

  reply	other threads:[~2018-05-08  7:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06  1:47 Finn Thain
2018-05-06  4:55 ` Greg Kroah-Hartman
2018-05-06  6:00   ` Finn Thain
2018-05-06 20:20     ` Greg Kroah-Hartman
2018-05-06 21:51       ` Michael Schmitz
2018-05-08  7:00         ` Greg Kroah-Hartman
2018-05-08  7:07           ` Geert Uytterhoeven
2018-05-08  7:25             ` Greg Kroah-Hartman
2018-05-08  7:35               ` Geert Uytterhoeven
2018-05-08  7:41                 ` Greg Kroah-Hartman
2018-05-08  8:01               ` Michael Schmitz
2018-05-06 23:57       ` Finn Thain
2018-05-07 12:53         ` Geert Uytterhoeven
2018-05-07 14:45           ` Greg Kroah-Hartman
2018-05-08  6:28             ` Geert Uytterhoeven
2018-05-07 23:44         ` Finn Thain
2018-05-08  6:32           ` Geert Uytterhoeven
2018-05-08  7:59             ` Finn Thain [this message]
2018-05-08  7:01         ` Greg Kroah-Hartman
     [not found] <5aee5ede.1c69fb81.353b4.5021SMTPIN_ADDED_MISSING@mx.google.com>
2018-05-08  7:39 ` Geert Uytterhoeven
2018-05-08  8:27   ` Finn Thain
  -- strict thread matches above, loose matches on Subject: below --
2018-05-06  1:47 Finn Thain

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=alpine.LNX.2.21.1805081638020.30@nippy.intranet \
    --to=fthain@telegraphics.com.au \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    /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

Powered by JetHome