Messages in this thread | | | Date | Thu, 4 Nov 2004 09:49:44 -0800 | From | Greg KH <> | Subject | Re: [PATCH 2.6.10-rc1 4/4] driver-model: attach/detach sysfs node implemented |
| |
On Thu, Nov 04, 2004 at 12:05:31PM -0500, Dmitry Torokhov wrote: > On Thursday 04 November 2004 02:46 am, Tejun Heo wrote: > > ?ma_04_manual_attach.patch > > > > ?This patch implements device interface nodes attach and detach. > > Reading attach node shows the name of applicable drivers. ?Writing a > > driver name attaches the device to the driver. ?Writing anything to > > the write-only detach node detaches the driver from the currently > > associated driver. > > > ... > > +/** > > + *???detach - manually detaches the device from its associated driver. > > + * > > + *???This is a write-only node. ?When any value is written, it detaches > > + *???the device from its associated driver. > > + */ > > +static ssize_t detach_store(struct device * dev, const char * buf, size_t > > n) > > +{ > > +?????down_write(&dev->bus->subsys.rwsem); > > +?????device_release_driver(dev); > > +?????up_write(&dev->bus->subsys.rwsem); > > +?????return n; > > +} > > This will not work for pretty much any bus but PCI because only PCI > allows to detach a driver leaving children devices on the bus. The > rest of buses remove children devices when disconnecting parent.
Yeah, I was glad you stepped in. Both of you are trying to work on the same problem, in different ways. It would be great if you both could work out a common method together.
> Also, there usually much more going on with regard to locking and > other bus-specific actions besides taking bus's rwsem when binding > devices. Serio bus will definitely get upset if you try to disconnect > even a leaf device in the manner presented above and I think USB > will get upset as well.
No, we can disconnect a driver from a device just fine for USB with no problems (as long as it's not the hub driver from a hub device, we need to never be able to disconnect those.)
thanks,
greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |