Re: orinoco_usb Request For Comments

From: Manuel Estrada Sainz (ranty-bulk@ranty.pantax.net)
Date: Fri Jun 27 2003 - 03:27:37 EST


On Thu, Jun 26, 2003 at 11:41:18PM +0200, Oliver Neukum wrote:
>
> > Please comment, how much of that or what else needs to be done to get
> > it in the kernel?
>
> if(dev->read.urb->status == -EINPROGRESS){
> warn("%s: Unlinking pending IN urb", __FUNCTION__);
> retval = bridge_remove_in_urb(dev);
> if(retval){
> dbg("retval %d status %d", retval,
> dev->read.urb->status);
> }
> }
>
> Unlink unconditionally.
>
> /* We don't like racing :) */
> ctx->outurb->transfer_flags &= ~URB_ASYNC_UNLINK;
> usb_unlink_urb(ctx->outurb);
> del_timer_sync(&ctx->timer);
>
> But neither do we like sleeping in interrupt. You can't simply unset the flag
> if somebody else may be needing it.
>
> More when I am rested :-)

 How about the attached patch, not pretty, but it should work.

 Have a nice day

         Manuel

-- 
--- Manuel Estrada Sainz <ranty@debian.org>
                         <ranty@bigfoot.com>
			 <ranty@users.sourceforge.net>
------------------------ <manuel.estrada@hispalinux.es> -------------------
Let us have the serenity to accept the things we cannot change, courage to
change the things we can, and wisdom to know the difference.

Index: orinoco_usb.c =================================================================== RCS file: /usr/local/cvsroot/ranty/orinoco/driver/orinoco_usb.c,v retrieving revision 1.80 diff -u -r1.80 orinoco_usb.c --- orinoco_usb.c 25 Jun 2003 18:37:59 -0000 1.80 +++ orinoco_usb.c 27 Jun 2003 08:24:09 -0000 @@ -1858,13 +1858,9 @@ dev->udev = NULL; //priv->hw_unavailable = 1; - if(dev->read.urb->status == -EINPROGRESS){ - warn("%s: Unlinking pending IN urb", __FUNCTION__); - retval = bridge_remove_in_urb(dev); - if(retval){ - dbg("retval %d status %d", retval, - dev->read.urb->status); - } + retval = bridge_remove_in_urb(dev); + if (retval) { + dbg("retval %d status %d", retval, dev->read.urb->status); } restart_list: spin_lock_irqsave(&dev->ctxq.lock, flags); @@ -1876,8 +1872,11 @@ spin_unlock_irqrestore(&dev->ctxq.lock, flags); /* We don't like racing :) */ - ctx->outurb->transfer_flags &= ~URB_ASYNC_UNLINK; usb_unlink_urb(ctx->outurb); + while (ctx->outurb->status == -EINPROGRESS) { + set_current_state (TASK_UNINTERRUPTIBLE); + schedule_timeout ((3 /*ms*/ * HZ)/1000) + } del_timer_sync(&ctx->timer); if (!list_empty(&ctx->list))

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 30 2003 - 22:00:26 EST