Re: [RFC] [PATCH] driver core: allow userspace to unbind drivers from devices.

Adam Belay
2004-11-16T06:15:39Z

On Tue, Nov 09, 2004 at 10:49:43PM -0500, Dmitry Torokhov wrote:
> On Tuesday 09 November 2004 07:33 pm, Greg KH wrote:
> > All we have to do is rework that rwsem lock. It's been staring at us
> > since the beginning of the driver core work, and we knew it would have
> > to be fixed eventually. So might as well do it now.
> >
> ...
> >
> > So, off to rework this mess...
> >
>
> Do you have any ideas here? For me it seems that the semaphore has a dual
> role - protecting bus's lists and ensuring that probe/remove routines are
> serialized across bus...
>
> In the meantime, can I please have bind_mode patch applied? I believe
> it is useful regardless of which bind/unbind solution will be adopted
> and having them will allow me clean up serio bus implementaion quite a
> bit.
>
> Pretty please...
>

I'm not sure what your bind_mode patch includes, but I would like to start a
general discussion on the bind/unbind issue.

I appreciate the effort, and I agree that this feature is important. However,
I would like to discuss a few issues.

1.) I don't think we should merge a patch that supports driver "unbind"
without also supporting driver "bind".

They're really very interelated, and we don't want to break userspace by
changing everything around when we discover a cleaner solution.

2.) I don't like having an "unbind" file.

This implies that we will have at least three seperate files controlling
driver binding when we really need only one or two at the most. Consider
"bind", "unbind", and the link to the driver that is bound.

An Alternative Solution
=======================

Why not have a file named "bind". We can write the name of the driver we want
bound to the device. When we want to unbind the driver we could do something
like this:

# echo "" > bind
or
# echo 0 > bind

At least then we only have the link and the "bind" file to worry about. I've
also been considering more inventive solutions (like deleting the symlink will
cause the driver to unbind). But it could get complex very quickly. Really,
we need to discuss this more.

I look forward to any comments.

Thanks,
Adam