> What I'd thought about was instead to just provide the URB to unlink
> if the timeout failed, device was disconnected, or whatever.  Why ask
> for some new api notion?  In fact I think I have code sitting somewhere
> around here that does exactly that, maybe I should dig it up...
>
> That means synchronous callers could
>
>       dev->some_urb = ... alloc+save, locked against disconnect ...
>       ... setup timeout to unlink the urb ...
>       sync_control_message (urb, bRequest, bRequestType, ...,
>               INTERRUPTIBLE or maybe not)
>       ... cancel that timeout
>       switch (urb->status) {
>       ...
>       }
>       free dev->som_urb
>
> and the disconnect code could just unlink all active/submitted urbs.

Splendid idea !
Have you ever considered leaving your brain to science?

But we could elaborate a little.

urb = usb_alloc_urb()
down()
usb_assign_urb_to_dev(urb, dev)
up()
error = sync_control_message(urb, timeout,...)

If we now let usb_submit_urb() do usb_assign_urb_to_dev() as
well, we've solved the problem.

Now the core can unlink all urbs assigned to a device after the
driver's disconnect has returned and before doing the kfree.
The driver's disconnect handler has to concern itself only
with urbs which are resubmitted in the completion handler.
All we have to make sure is that urb->dev is not altered
after usb_assign_urb_to_dev() and usb_unlink_urb() sets
it to NULL.

The problem of usb_submit_urb() needing mutual exclusion
with disconnect() still remains.

        Regards
                Oliver



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to