On Wed, Apr 27, 2005 at 04:14:08PM -0700, Patrick Mansfield wrote: > On Wed, Apr 27, 2005 at 05:21:10PM -0400, Alan Stern wrote: > > > David's right. Why did kobject_hotplug() move out of kobject_add() and > > into its callers sometime after 2.6.11? In particular the invocation in > > device_add() is in the wrong place; it needs to come before > > bus_add_device() starts probing for drivers. Otherwise, as David points > > out, when the drivers start registering child devices from their probe > > methods, the hotplug events for those child devices will appear before the > > event for the parent. > > But bus_add_device() calls device_add_attrs() to create attrs, if you call > it after the hotplug, the user space hotplug event shows up before the > sysfs attrs are created (if the driver is using the bus->dev_attrs field).
Do I get it right that at hotplug time the attributes do already exist, but it is the sysfs files which don't? It's certainly true for USB, I'm much less acquainted with other subsystems. Then, instead of trying to make sure the attributes are available via sysfs at hotplug time, we can use another means to pass them to hotplug: we can add a routine, which, when called from the .hotplug function and given pointers to struct attribute and struct device, would add environment variable SYSFS_attrName=attrValue using attribute's .name and .show, to the list of env variables exported to the hotplug callout. This would allow udev or whatever is called to get most relevant attributes via environment, if available, otherwise to poke in sysfs and wait until they show up. Sorry but I can't illustrate it with a patch at the moment as I'm leaving for four days off, maybe I'll be able to do it when I'm back. Cheers, Roman. ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel