Here are some answers to your question.  I don't know if you will find 
them very helpful...

On Wed, 25 Feb 2004, Juergen Stuber wrote:

> Hi,
> 
> I'm currently working to correct the locking problems in the
> LEGO USB Tower driver.  In the course of that I've read through
> the current version of usb-skeleton.c in 2.6.3, and I have
> a few questions and remarks:
> 
> - Parallel read and write are impossible due to locking on dev->sem.
>   Is that ok?

It's okay for usb-skeleton.  Whether or not it's okay for the LEGO Tower 
driver is up to you.

Anyway, it's not dev->sem that prevents parallel read and write.  It's the 
fact that reads use a blocking USB call.  Not to mention the question of 
whether or not the device itself will support simultaneous reading and 
writing.

>  If not, is there a standard way to fix it?

Change the read routine to use non-blocking USB calls, the way the write 
routine does.

>   This one is bothering me most, as it is currently the same in
>   the LEGO USB Tower driver.
> 
> - Read and write aren't interruptible and don't support nonblocking I/O.
>   How important is it to support nonblocking I/O?

Importance is a matter for the user to decide, not the kernel developer.

> - It would be nice to use a bigger buffer size than the packet size
>   as that is typical.

Then go ahead and do so.

> - Shouldn't seeking be forbidden by adding an llseek method
>   that forbids seeking by returning -ESPIPE?

It wouldn't hurt.  It's not clear whether it would help.

> - I suppose __FUNCTION__ should be replaced by __func__.

I've never heard of __func__.  If it means something different from 
__FUNCTION__ then no, it shouldn't be replaced.  If it means the same 
thing, then it would be okay (but probably nonstandard) to do the 
replacement.

> - The module use count is decremented after release, not before as
>   written in the comment at line 151.

So submit a patch to fix the comment.

Alan Stern



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to