The reason for adding the lock was David's firm belief that we should report a device disconnection (by setting the state to USB_STATE_NOTATTACHED) as soon as it is detected, rather than having to wait for a driver's disconnect() routine to run or to wait for usbdev->serialize. If the state is not protected by serialize then it needs some other sort of protection, and a global spinlock is the simplest way to do it.
Why does the lock have to be taken to set the state in this case? There is not more than one thread that is setting the state, right? Just multiple users.
I forget who pointed out that there needs to be some way to prevent anyone from changing from state NOTATTACHED to some other state (say, ADDRESS) accidentally. Hence the (spin)lock.
We really need to start over and make usbfs2. It should look something like the gadgetfs interface.
What about backward compatibility?
libusb would handle this.
And for a while, usbfs1 and usbfs2 should probably co-exist. But more on usbfs2 in other threads, later.
- Dave
------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel