public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Collins <ben.collins@ubuntu.com>
To: Nicholas Miell <nmiell@comcast.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Pushing device/driver binding decisions to userspace
Date: Sun, 12 Nov 2006 23:10:45 -0800	[thread overview]
Message-ID: <1163401845.5178.335.camel@gullible> (raw)
In-Reply-To: <1163400313.2801.11.camel@entropy>

On Sun, 2006-11-12 at 22:45 -0800, Nicholas Miell wrote:
> On Sun, 2006-11-12 at 21:22 -0800, Ben Collins wrote:
> > On Sun, 2006-11-12 at 17:47 -0800, Nicholas Miell wrote:
> > > On Sun, 2006-11-12 at 17:24 -0800, Ben Collins wrote:
> > > > On Sun, 2006-11-12 at 16:49 -0800, Nicholas Miell wrote:
> > > > > On Sun, 2006-11-12 at 15:39 -0800, Ben Collins wrote:
> > > > > 
> > > > > What's wrong with making udev or whatever unbind driver A and then bind
> > > > > driver B if the driver bound by the kernel ends up being the wrong
> > > > > choice? (Besides the inelegance of the kernel choosing one and then
> > > > > userspace immediately choosing the other, of course.)
> > > > > 
> > > > > I'd argue that having multiple drivers for the same hardware is a bit
> > > > > strange to begin with, but that's another issue entirely.
> > > > 
> > > > If two drivers are loaded for the same device, there's no way for udev
> > > > to tell the kernel which driver to use for a device, that I know of.
> > > 
> > > /sys/bus/*/drivers/*/{bind,unbind}
> > 
> > "bind" does not tell the driver core to "bind this device with this
> > driver", it tells it to "bind this driver to whatever devices we match
> > that aren't already bound".
> > 
> > That doesn't solve my use case.
> 
> I don't have any hardware with multiple drivers lying around, but I'm
> fairly certain you can write the bus ID of a device into driver A's
> unbind file and then follow that with a write of that bus ID into driver
> B's bind file and get the effect that you want.

Certainly, that's the case. However, it should be possible to do this
without letting the kernel bind a device to one driver, just to go back
and unbind it, and bind to another driver.

> > 
> > > > Also, that just sounds very horrible to do. If you have udev/dbus events
> > > > flying around for "device present", "device gone", "device present",
> > > > then it could make for a very ugly user experience (think of programs to
> > > > handle devices being started because of these events).
> > > 
> > > So don't fire the events until after the final binding.
> > 
> > It's still not a correct solution. If we want a specific driver to be
> > bound to a specific device, userspace shouldn't have to jump through
> > hoops to do it. It should be simple and clean.
> > 
> > The suggestions you are giving require userspace to work around a
> > deficiency in the kernel, by guessing the ordering requirements to
> > satisfy what the user wants. In cases of hotplugging, it is also
> > sometimes impossible to satisfy these requirements using the current
> > scheme.
> 
> Well, the kernel's deficiency is that there's multiple drivers for the
> same hardware, not that userspace doesn't get first say in how hardware
> is bound to drivers.

No, in a lot of cases, it's not a deficiency. Take the entire
drivers/ata/pata_*.ko list. All of them match an IDE driver, however the
pata driver most times does not support all the same PCI id's for the
matching ide driver.

Also the other case I gave where there is an alsa driver and a media
driver for the same chipset, is by design. It can't be helped. There
actually is a case for wanting one driver or the other in the case of
the exact same hardware, depending on the users desire.

  reply	other threads:[~2006-11-13  7:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-12 23:39 [RFC] Pushing device/driver binding decisions to userspace Ben Collins
2006-11-13  0:49 ` Nicholas Miell
2006-11-13  1:24   ` Ben Collins
2006-11-13  1:47     ` Nicholas Miell
2006-11-13  5:22       ` Ben Collins
2006-11-13  6:45         ` Nicholas Miell
2006-11-13  7:10           ` Ben Collins [this message]
2006-11-13  9:45             ` Martin Mares
2006-11-13 10:13             ` Xavier Bestel
2006-11-23 10:29         ` Greg KH
2006-11-23 11:40           ` Kay Sievers
2006-11-24  3:59             ` Greg KH
2006-11-13  7:58 ` Arjan van de Ven
2006-11-13 18:51   ` Lee Revell
2006-11-13 20:18     ` Arjan van de Ven
2006-11-13 22:16       ` Jim Crilly
2006-11-13 22:59         ` Lee Revell
2006-11-13 23:22           ` Jim Crilly
2006-11-13 23:45             ` Lee Revell
2006-11-14  1:14               ` Jim Crilly
2006-11-14  7:32         ` Arjan van de Ven
2006-11-14 17:11           ` Jim Crilly

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=1163401845.5178.335.camel@gullible \
    --to=ben.collins@ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nmiell@comcast.net \
    /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