From: Greg KH <greg@kroah.com>
To: dtor_core@ameritech.net
Cc: Tejun Heo <tj@home-tj.org>,
linux-kernel@vger.kernel.org,
Patrick Mochel <mochel@digitalimplant.org>
Subject: Re: [RFC] [PATCH] driver core: allow userspace to unbind drivers from devices.
Date: Tue, 9 Nov 2004 16:33:23 -0800 [thread overview]
Message-ID: <20041110003323.GA8672@kroah.com> (raw)
In-Reply-To: <d120d5000411091536115ac91b@mail.gmail.com>
On Tue, Nov 09, 2004 at 06:36:52PM -0500, Dmitry Torokhov wrote:
> Hi Greg,
>
> On Tue, 9 Nov 2004 14:37:29 -0800, Greg KH <greg@kroah.com> wrote:
> > Ok, everone's been back and forth about the whole bind/unbind stuff
> > lately, so let's just do this a step at a time.
> >
> > How about the following patch. It adds a "unbind" file to any device
> > that is bound to a driver. Writing any value to that file disconnects
> > the device from the driver associated with it.
> >
> > It's small, simple, and it works.
> >
> > It also can cause bad things to happen if you aren't careful about what
> > type of device you are unbinding (some i2c chip devices don't really
> > unbind from the driver fully, but that's an i2c issue, and I'm working
> > on it.)
> >
> > Also, unbinding a device from a driver can cause the children devices to
> > disappear, depending on the type of driver that is bound to the device.
>
> With the present implementation it is pretty much impossible to do
> since unbind grabs bus's rwsem. That means that any driver attempting
> to remove children will deadlock. Driver core is not aware of evry bus's
> topology issues that's why you need a bus method to do proper locking
> and children removal.
Ok, in looking some more at this, you are right.
So, how to solve this. I don't want a bus callback for bind, unbind,
re-bind, bind-every-other-day-depending-on-the-phase-of-the-moon, and so
on. I really think we can do this with the current callbacks that we
have today.
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.
Unfortunatly it seems everyone likes to grab that lock, so it's not
going to be a simple thing to fix (in their defense, we encouraged
people to grab the lock, so it's our fault too.)
So, if we fix up the locking issues, then we can do the following, which
I know people have been wanting to do:
- add new devices from within a probe() callback.
- remove other devices from within a probe() callback.
- remove other devices from the remove() callback.
- unbind devices from the driver core.
and other good stuff.
So, off to rework this mess...
thanks,
greg k-h
next prev parent reply other threads:[~2004-11-10 0:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-09 22:37 [RFC] [PATCH] driver core: allow userspace to unbind drivers from devices Greg KH
2004-11-09 23:36 ` Dmitry Torokhov
2004-11-10 0:33 ` Greg KH [this message]
2004-11-10 3:49 ` Dmitry Torokhov
2004-11-16 5:54 ` Greg KH
2004-11-16 20:43 ` Dmitry Torokhov
2004-11-16 23:08 ` Greg KH
2004-11-17 7:00 ` Dmitry Torokhov
2004-11-17 17:55 ` Greg KH
2004-11-16 6:13 ` Adam Belay
2004-11-16 6:37 ` Dmitry Torokhov
2004-11-16 7:04 ` Adam Belay
2004-11-16 20:22 ` Greg KH
2004-11-16 21:09 ` Dmitry Torokhov
2004-11-16 20:17 ` Greg KH
2004-11-17 7:07 ` Dmitry Torokhov
2004-11-17 17:53 ` Greg KH
2004-11-17 19:01 ` 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=20041110003323.GA8672@kroah.com \
--to=greg@kroah.com \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.org \
--cc=tj@home-tj.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