On Tue, 12 Aug 2003, David Brownell wrote: > Alan Stern wrote: > > > Maybe it's an attempt to protect against the "device-morphed" possibility. > > I'm planning a re-write of that whole area. For now, it would probably be > > okay to remove the down_read() and up_read() in usb_reset_device(). > > That "morphed" branch looks rather broken to me -- is there any > reason to believe it ever worked?
No. It never worked, and there's no reason to believe it ever worked. > For now I'm assuming that it > would be better implemented as a dev_warn() and usb_disconnect(). > (And most of those error paths should usb_disconnect, instead > of what they now do ..) That would still cause a lock-up for Andries, because it's occurring during probe(). > I'm thinking that all the config change logic for a given device > should be synchronizing using dev->serialize ... that seems to > be used only in usbfs right now, so it's useless except to keep > two user mode tasks from stepping on each other. > > Any routine that issues SET_CONFIGURATION or SET_INTERFACE should > probably lock against routines affecting that same device. That > "serialize" lock has the right scope: device, not all-of-usb. > Getting that scope right should make this hang vanish. Using dev->serialize was part of my proposal for the reset_device() reorganization. However, the locking may not be as necessary as you think. Following Oliver's suggestion, set_configuration() would unbind all interfaces other than the one making the request before doing anything else. Of course, that still leaves the problem of requests coming by way of usbfs or sysfs. My proposal addressed that too. The usb_device structure would get a new flag, state_change_pending. If the flag was already set, usb_reset_device(), usb_set_configuration(), and usb_set_interface() -- and now also usb_reset_configuration() -- would merely return -EBUSY. Alan Stern ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel