Am Donnerstag, 8. Februar 2007 14:40 schrieb Edwin Olson:
> * Is my locking correct?
Short answer: No.
Long answer:
/* prevent the device from being autosuspended */
retval = usb_autopm_get_interface(interface);
if (retval)
goto exit;
/* increment our usage count for the device */
kref_get(&dev->kref);
Reverse the order. You lose BKL protection if usb_autopm_get_interface()
sleeps.
dev->read_pending = 0;
This is senseless. susi_read_more() is called from read(). If you touch
this variable in interrupt, it needs a spinlock. In any case you are dropping
it too early.
while (kfifo_len(dev->read_fifo) == 0) {
If susi_read_more() gets an error, you'll loop forever.
if (wait_event_interruptible(dev->readq,
kfifo_len(dev->read_fifo)!=0))
return -ERESTARTSYS;
Deadly if the device is disconnected.
HTH
Oliver
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel