Am Donnerstag, 13. Mai 2004 20:02 schrieb Alan Stern:
> +void usb_kill_urb(struct urb *urb)
> +{
> +       urb->transfer_flags |= (URB_ASYNC_UNLINK | URB_REJECT);
> +       usb_unlink_urb(urb);
> +       wait_event(urb->handler_queue, atomic_read(&urb->use_count) == 0);
> +       urb->transfer_flags &= ~(URB_ASYNC_UNLINK | URB_REJECT);
> +}
> +

Here I see a little problem.
1. URB_REJECT
You cannot simply define a new transfer_flag, because the completion
handler may clear transfer_flags. Either add a further field, or use maskes
in in the fill_urb functions
2. URB_ASYNC_UNLINK
The completion handler may certainly reset that flag, so it has to work
without it. Therefore it makes little sense to set it.
3. use of an atomic_t
You could use a short and use the spinlock already in the URB to protect
it. It saves two bytes on x86.

        Regards
                Oliver



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&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