On Sun, 26 Mar 2006, Franck Bui-Huu wrote:

> I got 2 more questions, hope you don't mind.
> 
> Can I assert that the ep0's request queue has always one request queued ?

No, of course not.  Most of the time there won't be any requests queued.  
On ep0, requests are queued only in response to Setup packets from the 
host.

> Is it safe when aborting all requests of an ep's queue to do
> 
>         while (queue is not empty) {
>                 request = first request of the queue
>                 remove_request_from_queue(request);
>                 driver->complete(request, status = -ERROR);
>         }
> 
> I mean, am I sure that the driver won't queue another request to the queue ?

No, you can't be sure of that.  But if the gadget driver does queue 
another request, it has to take the consequences.  In these circumstances 
it's not defined whether the new request would also get aborted.

So yes, that is a workable algorithm.  If instead you tried to do this:

        lastreq = last request of the queue
        while (queue is not empty) {
                request = first request of the queue
                dequeue(request)
                driver->complete(request, status = -ERROR);
                if (request == lastreq)
                        break;
        }

then you run the risk of the gadget driver deleting lastreq by itself,
before you do.  Hence you might as well stick to the simpler algorithm.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to