mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: "Rene Herman" <rene.herman@keyaccess.nl>
Cc: "Greg KH" <gregkh@suse.de>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	tiwai@suse.de, "Andrew Morton" <akpm@osdl.org>,
	"Russell King" <rmk+lkml@arm.linux.org.uk>
Subject: Re: patch bus_add_device-losing-an-error-return-from-the-probe-method.patch added to gregkh-2.6 tree
Date: Wed, 5 Apr 2006 10:59:04 -0400	[thread overview]
Message-ID: <d120d5000604050759k576133a9t90dd02c35fce91af@mail.gmail.com> (raw)
In-Reply-To: <4433CB34.6010707@keyaccess.nl>

On 4/5/06, Rene Herman <rene.herman@keyaccess.nl> wrote:
> Dmitry Torokhov wrote:
>
> > On Tuesday 04 April 2006 18:12, Rene Herman wrote:
>
> >> To Dmitry, I see you saying "probe() failing is driver's problem.
> >> The device is still there and should still be presented in sysfs.".
> >> No, at least in the case of these platform drivers (or at least
> >> these old ISA cards using the platform driver interface), a -ENODEV
> >> return from the probe() method would mean the device is _not_
> >> present (or not found at least). NODEV.
> >
> > Or you could separate device probing code from driver->probe(). BTW I
> > think that ->probe() is not the best name for that method.
>
> Right...
>
> > It really is supposed to allocate resources and initialize the device
> > so that it is ready to be used, not to verify that device is present.
> > The code that created device shoudl've done that.
>
> How do you feel about the flag that I've been proposing that a driver
> that needs to probe for its hardware could set and that says "if we
> return an error (or specifically -ENODEV I guess) the hardware's
> reallyreally not present and the device should not register"?
>
> Greg, and how do you feel about such a flag?
>
> As an alternative to the flag, how would either of you feel about either
>
> 1) adding a .discover method to struct device_driver that noone other
> than drivers for this old non generically discoverable hardware would
> set but which would make a registration fail if set and returning < 0?
>
> 2) adding that method only to platform_driver?
>
> 3) ... and after a few months when people aren't paying attention
> anymore rename .probe to .init and .discover back to .probe? ;-)
>

You need to let go of the model that driver that drives hardware also
do the device discovery and it will all fall into place. While it may
be contained in the same source module it is 2 different code chunks
(for the lack of the better word) and we should not mix them together.

> Russel, you wrote:
>
> > Note also that this patch will not do what the ALSA folk want - they
> > want to know if the device was found or whether the probe returned
> > -ENODEV. We knock -ENODEV and -ENXIO to zero in
> > driver_probe_device(), so they won't even see that.
>
> Yes, I know about the -ENODEV / -ENXIO thing. I asked for comment on
> that as well, but haven't gotten any.
>
> Anyways, the additional method would, I feel, be the conceptually
> cleanest approach. Practically speaking though, simply doing a manual
> probe and only calling platform_register() after everything is found to
> be present and accounted for is not much of a problem either.
>

Unfortunately it breaks manual driver binding/unbinding through sysfs
so I don't think it is a good long-term solution.

--
Dmitry

  reply	other threads:[~2006-04-05 14:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-24  5:32 bus_add_device() losing an error return from the probe() method Rene Herman
2006-03-26  1:53 ` Andrew Morton
2006-03-26 22:30   ` Rene Herman
2006-04-04 19:10 ` patch bus_add_device-losing-an-error-return-from-the-probe-method.patch added to gregkh-2.6 tree gregkh
2006-04-04 20:23   ` Dmitry Torokhov
2006-04-04 21:00     ` Greg KH
2006-04-04 21:15       ` Greg KH
2006-04-04 21:22         ` Andrew Morton
2006-04-04 21:28       ` Dmitry Torokhov
2006-04-04 21:45         ` Greg KH
2006-04-05  1:35           ` Dmitry Torokhov
2006-04-05  7:36             ` Russell King
2006-04-06  1:05               ` Greg KH
2006-04-05  1:59           ` Dmitry Torokhov
2006-04-04 22:12       ` Rene Herman
2006-04-05  0:23         ` Rene Herman
2006-04-05  1:45           ` Dmitry Torokhov
2006-04-05 18:36             ` Rene Herman
2006-04-05 18:44               ` Dmitry Torokhov
2006-04-05  1:48         ` Dmitry Torokhov
2006-04-05 13:50           ` Rene Herman
2006-04-05 14:59             ` Dmitry Torokhov [this message]
2006-04-05 21:22               ` Rene Herman
2006-04-05 13:55           ` Rene Herman

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=d120d5000604050759k576133a9t90dd02c35fce91af@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=akpm@osdl.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=dtor_core@ameritech.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rene.herman@keyaccess.nl \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=tiwai@suse.de \
    /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

all inboxes | Powered by JetHome®