From: Greg KH <greg@kroah.com>
To: dtor_core@ameritech.net
Cc: linux-kernel@vger.kernel.org, Patrick Mochel <mochel@digitalimplant.org>
Subject: Re: [RFC] bind and unbind drivers from userspace through sysfs
Date: Fri, 1 Jul 2005 15:31:14 -0700 [thread overview]
Message-ID: <20050701223114.GC2707@kroah.com> (raw)
In-Reply-To: <d120d500050630132025610e6a@mail.gmail.com>
On Thu, Jun 30, 2005 at 03:20:10PM -0500, Dmitry Torokhov wrote:
> On 6/30/05, Greg KH <greg@kroah.com> wrote:
> > On Thu, Jun 30, 2005 at 01:13:53AM -0500, Dmitry Torokhov wrote:
> > > On Wednesday 29 June 2005 18:47, Greg KH wrote:
> > > > On Fri, Jun 24, 2005 at 11:22:57PM -0500, Dmitry Torokhov wrote:
> > > > > On Friday 24 June 2005 00:12, Greg KH wrote:
> > > > > > Even so, with these two patches, people should be able to do things that
> > > > > > they have been wanting to do for a while (like take over the what driver
> > > > > > to what device logic in userspace, as I know some distro installers
> > > > > > really want to do.)
> > > > > >
> > > > >
> > > > > I think bind/unbind should be bus's methods and attributes should be
> > > > > created only if bus supports such operations. Some buses either have
> > > > > or may need additional locking considerations and will not particularly
> > > > > like driver core getting in the middle of things.
> > > >
> > > > Examples of such?
> > >
> > > serio, gameport. Everything is protected by a semaphore, partly for
> > > historical reasons, partly because when adding children devices parent
> > > devices need to be locked too...
> >
> > Why do parent devices need to be locked? Reference counting in the
> > driver core should take care of everything properly, right? Also, these
>
> Children devices access hardware thtough their parent, which has to be
> functional at that time, otherwise if you initializing child device
> while parent is half gone you'll get bunch of errors reported. And
> again - historical reasons - when driver core did not allow adding
> children from parents probe routines serio core had to work around it
> and it required additional locking.
Ok, that locking can now be removed :)
> > are not hotpluggable devices, so it should be a lot easier :)
>
> Some of them are and some are not. Hot-plugging an PS/2 mouse or
> keyboard usually works, although there are exceptions.
hot-plugging a ps/2 device is a short trip to a burnt out motherboard.
I've worked with the ps/2 specs long enough to know that :)
Anyway, you aren't discovering them on the fly, but I see how a rescan
would help you out here, right?
> > > > > Btw, do we really need separate attributes for bind/unbind?
> > > >
> > > > Overloading a single file would be messier. The overhead for an
> > > > additional attribute per driver is quite small (I move the unbind
> > > > attribute to the driver, as it makes more sense there as Pat mentioned.)
> > > >
> > >
> > > Let me ask again - what if we need more operations similar to [un]bind,
> > > such as rescan?
> >
> > "rescan"? Like reprobe the bus address space? That sounds like a bus
> > specific issue. But if you like I could add a general bus callback for
> > that and an attribute for it. I know pci could use that for some odd
> > cases (see the fakephp driver for an example of how to do rescan for pci
> > devices from a driver itself.)
> >
>
> No, it for entire bus space. Imagine you have a device that is marked
> as "bind_mode=manual" because normally you don't want to have it
> activated for some reason.
I don't like "modes" like that. Just have the driver have no built in
ids, then use the addition of a dynamic id from userspace do the bind,
like pci.
> Later you want to activate it. Right now in serio you can do:
>
> echo -n "rescan" > /sys/bus/serio/devices/serioX/drvctl
>
> and it will do the standard binding (match + probe) for that device
> only. It is different from bus-wide rescan operation. Maybe rescan is
> not the best name, but that what I have in serio for now.
Sure, for this I think it should be a bus specific thing.
> Reconnect is indeed bus-specific issue but it is very close to rescan.
> We already know the driver, we just want to reinitialize hardware, if
> possible. Helps to keep input devices the same when mouse goes crazy
> for some reason.
But rescan/reconnect is a bus thing. The driver core never kicks this
off, nor should it.
> > > They do not use a specific driver but work for device.
> >
> > Yes, and as such, rescan should be a bus attribute, not a driver or
> > device one.
>
> See above, I want a per-device operation here. Bus-wide one could be
> also useful, but I was talking about per-device.
per-device scan doesn't make much sense for other busses, does it?
> > > If you keep bind/unbind in driver and rescan/reconnect/etc in device
> > > subdirectoty it will be rather messy. Please consider movin in the
> > > opposite directtion - have bind and unbind attributes of device, not
> > > driver.
> >
> > No, I put bind/unbind in the driver directory. There is no additions to
> > the device directory.
> >
>
> Could you give your rationale for putting it in driver?
The driver is the thing you want to have bound to a device. Putting it
in every device directory would make the 20K scsi device people very
unhappy as I take up even more of their 31bit memory :)
> > > Also, what about rolling bind_mode attribute into driver core as well?
> >
> > Um, I don't recall what you are referring to here. Have a
> > pointer/patch?
> >
>
> No patch at the moment, there were quite few changes since I sent it
> to you last time. You could take a look in serio for the usage though.
> Basically both drivers and devices get a new attribute "bind_mode"
> (auto|manual). When bind mode is set to manual devices are bound to
> driver only when user explicitely says so. This allows having 2+
> drivers for the same hardware at the same time. The preferred one has
> bind_mode=auto, secondary has bind_mode=manual. Take for example
> serio_raw. We really want psmouse be loaded by default but if user
> needs raw access to a specific serio port he can manually bind
> serio_raw module to that port.
Ah, ok, now I remember. I still think this is more complex than needed,
but don't have an alternative proposal right now :)
thanks,
greg k-h
next prev parent reply other threads:[~2005-07-02 1:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-24 5:12 [RFC] bind and unbind drivers from userspace through sysfs Greg KH
2005-06-24 5:14 ` [PATCH] driver core: Add the ability to unbind drivers to devices from userspace Greg KH
2005-06-24 5:15 ` [PATCH] driver core: Add the ability to bind " Greg KH
2005-06-24 15:57 ` [PATCH] driver core: Add the ability to unbind " Patrick Mochel
2005-06-25 3:27 ` Greg KH
2005-06-25 4:16 ` Dmitry Torokhov
2005-06-25 9:39 ` Michael Tokarev
2005-06-25 3:05 ` [RFC] bind and unbind drivers from userspace through sysfs Bill Nottingham
2005-06-25 3:26 ` Greg KH
2005-06-25 4:22 ` Dmitry Torokhov
2005-06-29 23:47 ` Greg KH
2005-06-30 6:13 ` Dmitry Torokhov
2005-06-30 16:01 ` Greg KH
2005-06-30 20:20 ` Dmitry Torokhov
2005-07-01 22:31 ` Greg KH [this message]
2005-07-02 4:25 ` Dmitry Torokhov
2005-07-02 4:51 ` Greg KH
2005-07-02 5:20 ` Dmitry Torokhov
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=20050701223114.GC2707@kroah.com \
--to=greg@kroah.com \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.