On Thu, May 13, 2004 at 02:42:29PM -0400, Alan Stern wrote:
> On Thu, 13 May 2004, Greg KH wrote:
> 
> > I don't object to that, I object to a new function call.  If we add
> > this, then what's the use of usb_unlink_urb() at all?  Why would a
> > driver ever want to call it?
> 
> You mean, what's the use of synchronous usb_unlink_urb() -- asynchronous 
> is a separate thing and still necessary; it's used within usb_kill_urb().
> 
> > So, why not just fix usb_unlink_urb() to do the same thing that this
> > usb_kill_urb() call does?  That seems much simpler to do, and no drivers
> > will have to be changed.
> 
> I thought about doing that.  It certainly would simplify hcd_unlink_urb() 
> considerably.
> 
> Here's two reasons to keep usb_kill_urb apart from usb_unlink_urb:
> 
>     1.        Overloading usb_unlink_urb() to handle both synchronous and
>       asynchronous unlinking was a mistake from the beginning.

I agree.

>       Now we can finally have two different routines for the two
>       different purposes: usb_unlink_urb() for asynch. and
>       usb_kill_urb() for synchronous unlinks.

Ok, fair enough.

>     2.        It's just barely possible, albeit highly unlikely, that some 
>       driver somewhere relies on the peculiar semantics of synchronous
>       usb_unlink_urb().  I can't imagine how or why, and if a driver
>       does so it's probably by mistake.  But on the off chance, I
>       didn't want to completely replace synch. unlink_urb.

Yeah, possibly, but I really doubt it.

> On the other hand, if you feel that usb_kill_urb() can take over the job 
> of asynchronous unlinking with no problem, then we can simply add this 
> code to the start of usb_unlink_urb():
> 
>       /* Replace synchronous unlinks with usb_kill_urb() */
>       if (!(usb->transfer_flags & URB_ASYNC_UNLINK)) {
>               usb_kill_urb(urb);
>               return 0;
>       }

Ok, I like this.  This gives us a transition for drivers to make over
time, and it should not break any current users, right?

Then, in 2.7 we can just get rid of the URB_ASYNC_UNLINK flag all
together, and then backport the changes to 2.6 :)

> (Notice that the return code is meaningless.  That's one of the 
> differences between synchronous unlink and kill_urb.)
> 
> This also would allow hcd_unlink_urb() to be greatly simplified.
> Later on, drivers can be changed to call usb_kill_urb() directly.

Sounds good.  Care to respin the patch with this minor change?

Anyone else have any objections?

thanks,

greg k-h


-------------------------------------------------------
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=2562&alloc_id=6184&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