linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manuel Estrada Sainz <ranty-bulk@ranty.pantax.net>
To: Oliver Neukum <neukum@fachschaft.cup.uni-muenchen.de>
Cc: LKML <linux-kernel@vger.kernel.org>, orinoco-usb-devel@ranty.pantax.net
Subject: Re: orinoco_usb Request For Comments
Date: Wed, 2 Jul 2003 12:17:47 +0200	[thread overview]
Message-ID: <20030702101747.GA4137@ranty.pantax.net> (raw)
In-Reply-To: <Pine.LNX.4.53.0306271213350.5135@fachschaft.cup.uni-muenchen.de>

[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]

On Fri, Jun 27, 2003 at 12:15:04PM +0200, Oliver Neukum wrote:
> 
> 
> On Fri, 27 Jun 2003, Manuel Estrada Sainz wrote:
> 
> > On Thu, Jun 26, 2003 at 11:41:18PM +0200, Oliver Neukum wrote:
> > > 		/* 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.
> 
> It is much too ugly. Please use a struct completion or a waitqueue.
 
 How about this?

 The other choice is to just wait on the completion unconditionally and
 let timers expire on their own if needed.
 
 That would probably be more robust, and waiting a few extra seconds on
 module removal (which would just happen when the card hangs) is
 probably OK.  What do you think?

 Thanks

 	Manuel

 PS: Ideas on how to make the PCMCIA vs. USB integration (specially the
 locking) cleaner would be very, very welcomed. 

-- 
--- 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.

[-- Attachment #2: orinoco-oliver.diff --]
[-- Type: text/plain, Size: 1631 bytes --]

Index: orinoco_usb.c
===================================================================
RCS file: /usr/local/cvsroot/ranty/orinoco/driver/orinoco_usb.c,v
retrieving revision 1.85
diff -u -r1.85 orinoco_usb.c
--- orinoco_usb.c	1 Jul 2003 23:52:11 -0000	1.85
+++ orinoco_usb.c	2 Jul 2003 10:00:50 -0000
@@ -400,7 +400,7 @@
 			netif_wake_queue(net_dev);
 			break;
 		}
-		complete(&ctx->done);
+		complete_all(&ctx->done);
 		bridge_request_context_put(ctx);
 		break;
 		
@@ -410,7 +410,7 @@
 			/* This is normal, as all request contexts get flushed
 			 * when the device is disconnected */
 			err("Called, CTLX not terminating, but device gone");
-			complete(&ctx->done);
+			complete_all(&ctx->done);
 			bridge_request_context_put(ctx);
 			break;
 		}
@@ -1881,13 +1881,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);
@@ -1899,8 +1895,10 @@
 		spin_unlock_irqrestore(&dev->ctxq.lock, flags);
 		
 		/* We don't like racing :) */
-		ctx->outurb->transfer_flags &= ~URB_ASYNC_UNLINK;
-		usb_unlink_urb(ctx->outurb);
+		if (ctx->outurb->status == -EINPROGRESS) {
+			usb_unlink_urb(ctx->outurb);
+			wait_for_completion(&ctx->done);
+		}
 		del_timer_sync(&ctx->timer);
 		
 		if (!list_empty(&ctx->list))

  parent reply	other threads:[~2003-07-02 10:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-26 20:58 orinoco_usb Request For Comments Manuel Estrada Sainz
2003-06-26 21:41 ` Oliver Neukum
2003-06-26 23:09   ` Manuel Estrada Sainz
2003-06-27  8:27   ` Manuel Estrada Sainz
     [not found]     ` <Pine.LNX.4.53.0306271213350.5135@fachschaft.cup.uni-muenchen.de>
2003-07-02 10:17       ` Manuel Estrada Sainz [this message]
2003-07-02 14:02         ` Oliver Neukum
2003-06-26 22:03 ` [Orinoco-devel] " Pavel Roskin
2003-06-26 22:50   ` Manuel Estrada Sainz
2003-06-27 21:49     ` Pavel Roskin
2003-06-27 22:16       ` Manuel Estrada Sainz
2003-06-27  2:55   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030702101747.GA4137@ranty.pantax.net \
    --to=ranty-bulk@ranty.pantax.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neukum@fachschaft.cup.uni-muenchen.de \
    --cc=orinoco-usb-devel@ranty.pantax.net \
    --cc=ranty@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).