netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: netdev@oss.sgi.com
Cc: jgarzik@redhat.com, hermes@gibson.dropbear.id.au
Subject: R[PATCH 2.6.10-rc1 8/15] wireless/orinoco: Refactor spinlocks so we don't necessarily have to disable interrupts
Date: Tue, 26 Oct 2004 15:04:32 -0400	[thread overview]
Message-ID: <1098817472.3663.66.camel@dcbw.boston.redhat.com> (raw)
In-Reply-To: <1098814320.3663.24.camel@dcbw.boston.redhat.com>

Update in-kernel orinoco wireless drivers to upstream CVS.
None of this is original code by Dan Williams, simply a
broken down patch set split-out from upstream orinoco CVS.

o Refactor spinlocks so we don't necessarily have to disable interrupts

Signed-off-by: Dan Williams <dcbw@redhat.com>

--- a/drivers/net/wireless/orinoco.h.8-orinoco-spinlock	2004-10-26 10:44:41.445687264 -0400
+++ b/drivers/net/wireless/orinoco.h	2004-10-26 10:45:39.296892544 -0400
@@ -71,6 +71,8 @@
 	u16 channel_mask;
 	int broken_disableport;
 
+	unsigned int irq_no_disable:1;
+
 	/* Configuration paramaters */
 	u32 iw_mode;
 	int prefer_port3;
@@ -129,11 +131,17 @@
 extern inline int orinoco_lock(struct orinoco_private *priv,
 			       unsigned long *flags)
 {
-	spin_lock_irqsave(&priv->lock, *flags);
+	if (priv->irq_no_disable)
+		spin_lock_bh(&priv->lock);
+	else
+		spin_lock_irqsave(&priv->lock, *flags);
 	if (priv->hw_unavailable) {
-		printk(KERN_DEBUG "orinoco_lock() called with hw_unavailable (dev=%p)\n",
+		DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
 		       priv->ndev);
-		spin_unlock_irqrestore(&priv->lock, *flags);
+		if (priv->irq_no_disable)
+			spin_unlock_bh(&priv->lock);
+		else
+			spin_unlock_irqrestore(&priv->lock, *flags);
 		return -EBUSY;
 	}
 	return 0;
@@ -142,7 +150,27 @@
 extern inline void orinoco_unlock(struct orinoco_private *priv,
 				  unsigned long *flags)
 {
-	spin_unlock_irqrestore(&priv->lock, *flags);
+	if (priv->irq_no_disable)
+		spin_unlock_bh(&priv->lock);
+	else
+		spin_unlock_irqrestore(&priv->lock, *flags);
+}
+
+extern inline void orinoco_spin_lock(struct orinoco_private *priv)
+{
+	if (priv->irq_no_disable)
+		spin_lock_bh(&priv->lock);
+	else
+		spin_lock_irq(&priv->lock);
 }
 
+extern inline void orinoco_spin_unlock(struct orinoco_private *priv)
+{
+	if (priv->irq_no_disable)
+		spin_unlock_bh(&priv->lock);
+	else
+		spin_unlock_irq(&priv->lock);
+}
+
+
 #endif /* _ORINOCO_H */
--- a/drivers/net/wireless/orinoco.c.8-orinoco-spinlock	2004-10-26 10:44:41.444687416 -0400
+++ b/drivers/net/wireless/orinoco.c	2004-10-26 10:45:39.301891784 -0400
@@ -699,13 +699,13 @@
 	/* We mustn't use orinoco_lock() here, because we need to be
 	   able to close the interface even if hw_unavailable is set
 	   (e.g. as we're released after a PC Card removal) */
-	spin_lock_irq(&priv->lock);
+	orinoco_spin_lock(priv);
 
 	priv->open = 0;
 
 	err = __orinoco_down(dev);
 
-	spin_unlock_irq(&priv->lock);
+	orinoco_spin_unlock(priv);
 
 	return err;
 }
@@ -1966,7 +1966,7 @@
 		return;
 	}
 
-	spin_lock_irq(&priv->lock); /* This has to be called from user context */
+	orinoco_spin_lock(priv); /* This has to be called from user context */
 
 	priv->hw_unavailable--;
 
@@ -1981,7 +1981,7 @@
 			dev->trans_start = jiffies;
 	}
 
-	spin_unlock_irq(&priv->lock);
+	orinoco_spin_unlock(priv);
 
 	return;
 }
@@ -2404,9 +2404,9 @@
 
 	/* Make the hardware available, as long as it hasn't been
 	 * removed elsewhere (e.g. by PCMCIA hot unplug) */
-	spin_lock_irq(&priv->lock);
+	orinoco_spin_lock(priv);
 	priv->hw_unavailable--;
-	spin_unlock_irq(&priv->lock);
+	orinoco_spin_unlock(priv);
 
 	printk(KERN_DEBUG "%s: ready\n", dev->name);
 
--- ./orinoco_cs.c.8-orinoco-spinlock	2004-10-26 10:44:41.440688024 -0400
+++ ./orinoco_cs.c	2004-10-26 10:45:39.303891480 -0400
@@ -513,12 +513,12 @@
 	case CS_EVENT_CARD_REMOVAL:
 		link->state &= ~DEV_PRESENT;
 		if (link->state & DEV_CONFIG) {
-			orinoco_lock(priv, &flags);
+			unsigned long flags;
 
+			spin_lock_irqsave(&priv->lock, flags);
 			netif_device_detach(dev);
 			priv->hw_unavailable++;
-
-			orinoco_unlock(priv, &flags);
+			spin_unlock_irqrestore(&priv->lock, flags);
 		}
 		break;
 

  parent reply	other threads:[~2004-10-26 19:04 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-26 18:12 [PATCHES] wireless: Update in-kernel orinoco driver Dan Williams
2004-10-26 18:33 ` [PATCH 2.6.10-rc1 1/15] wireless/orinoco: Use msleep() instead of hardcoded schedule_timeout()s Dan Williams
2004-10-26 18:47   ` Christoph Hellwig
2004-10-26 19:35     ` Dan Williams
2004-10-26 19:42       ` Christoph Hellwig
2004-10-26 19:55         ` Dan Williams
2004-10-27  3:13           ` David Gibson
2004-10-27 13:11             ` Dan Williams
2004-10-28  1:42               ` David Gibson
2004-10-26 19:34   ` Jeff Garzik
2004-10-26 18:38 ` [PATCH 2.6.10-rc1 1/15] wireless/orinoco: use msleep() Dan Williams
2004-10-26 18:39 ` [PATCH 2.6.10-rc1 2/15] wireless/orinoco: fix up printk text Dan Williams
2004-10-26 18:43 ` [PATCH 2.6.10-rc1 3/15] wireless/orinoco: encapsulate direct hardware operations Dan Williams
2004-10-27  3:15   ` David Gibson
2004-10-26 18:45 ` [PATCH 2.6.10-rc1 4/15] wireless/orinoco: Update orinoco changelog and module parameters Dan Williams
2004-10-26 19:36   ` Jeff Garzik
2004-10-27  3:15   ` David Gibson
2004-10-26 18:47 ` [PATCH 2.6.10-rc1 5/15] wireless/orinoco: Update orinoco pcmcia driver's IRQ handling Dan Williams
2004-10-26 18:51 ` [PATCH 2.6.10-rc1 6/15] wireless/orinoco: New device data release function Dan Williams
2004-10-26 18:56 ` [PATCH 2.6.10-rc1 7/15] wireless/orinoco: Update card reset/init code and add card-specific data structures Dan Williams
2004-10-26 19:43   ` Jeff Garzik
2004-10-27  4:00     ` David Gibson
2004-10-26 19:04 ` Dan Williams [this message]
2004-10-26 19:44   ` R[PATCH 2.6.10-rc1 8/15] wireless/orinoco: Refactor spinlocks so we don't necessarily have to disable interrupts Jeff Garzik
2004-10-27  4:14     ` David Gibson
2004-10-26 19:07 ` [PATCH 2.6.10-rc1 9/15] wireless/orinoco: Remove dump_recs in preparation for a more flexible replacement Dan Williams
2004-10-26 19:13 ` [PATCH 2.6.10-rc1 10/15] wireless/orinoco: Use wireless handlers rather than ioctl()s Dan Williams
2004-10-26 19:18 ` [PATCH 2.6.10-rc1 11/15] wireless/orinoco: Clean up firmware version & capability detection Dan Williams
2004-10-26 19:20 ` [PATCH 2.6.10-rc1 12/15] wireless/orinoco: Use netif routines rather than keeping link state ourselves Dan Williams
2004-10-26 19:22 ` [PATCH 2.6.10-rc1 13/15] wireless/orinoco: RF monitor mode support Dan Williams
2004-10-26 19:24 ` [PATCH 2.6.10-rc1 14/15] wireless/orinoco: add minimal ethtool support Dan Williams
2004-10-26 19:46   ` Jeff Garzik
2004-10-27  4:01     ` David Gibson
2004-10-26 19:28 ` [PATCH 2.6.10-rc1 15/15] wireless/orinoco: Wireless scanning support Dan Williams
2004-10-26 19:33   ` Francois Romieu
2004-10-27  4:06     ` David Gibson
2004-10-27  2:05 ` [PATCHES] wireless: Update in-kernel orinoco driver 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=1098817472.3663.66.camel@dcbw.boston.redhat.com \
    --to=dcbw@redhat.com \
    --cc=hermes@gibson.dropbear.id.au \
    --cc=jgarzik@redhat.com \
    --cc=netdev@oss.sgi.com \
    /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).