]> err.no Git - linux-2.6/commitdiff
libertas: clean up lbs_interrupt()
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 10 Dec 2007 19:58:37 +0000 (14:58 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:06:35 +0000 (15:06 -0800)
Make it take struct lbs_private as argument; that's all it wants anyway,
and all callers were starting off from that. Don't wake the netif
queues, because those should be handled elsewhere. And sort out the
locking, with a big nasty warning for those who don't have the
driver_lock locked when they call it.

Oh, and fix if_cs.c to lock the driver_lock before calling it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/decl.h
drivers/net/wireless/libertas/if_cs.c
drivers/net/wireless/libertas/if_sdio.c
drivers/net/wireless/libertas/if_usb.c
drivers/net/wireless/libertas/main.c

index a086d0c6dfed78dcfd2e8a46115584343821954d..82727a87ea929887f73ccbd0fa26ae2ff9973362 100644 (file)
@@ -39,7 +39,7 @@ void lbs_queue_cmd(struct lbs_private *priv,
 int lbs_allocate_cmd_buffer(struct lbs_private *priv);
 int lbs_execute_next_command(struct lbs_private *priv);
 int lbs_process_event(struct lbs_private *priv);
-void lbs_interrupt(struct net_device *);
+void lbs_interrupt(struct lbs_private *priv);
 int lbs_set_radio_control(struct lbs_private *priv);
 u32 lbs_fw_index_to_data_rate(u8 index);
 u8 lbs_data_rate_to_fw_index(u32 rate);
index 49a01780dd03296b036086e09c20fe251bb368a4..2acbe5dcff7de6d195397e972d7dedfede88e6ce 100644 (file)
@@ -264,8 +264,9 @@ static irqreturn_t if_cs_interrupt(int irq, void *data)
                /* clear interrupt */
                if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK);
        }
-
-       lbs_interrupt(card->priv->dev);
+       spin_lock(&card->priv->driver_lock);
+       lbs_interrupt(card->priv);
+       spin_unlock(&card->priv->driver_lock);
 
        return IRQ_HANDLED;
 }
index 24239609367fe1dc0d474202351f75d6a4741785..1ed72b9b6bf228a392c62e438152e82cbf25d193 100644 (file)
@@ -154,7 +154,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card,
 
        card->int_cause |= MRVDRV_CMD_UPLD_RDY;
 
-       lbs_interrupt(card->priv->dev);
+       lbs_interrupt(card->priv);
 
        ret = 0;
 
@@ -236,7 +236,7 @@ static int if_sdio_handle_event(struct if_sdio_card *card,
        card->event = event;
        card->int_cause |= MRVDRV_CARDEVENT;
 
-       lbs_interrupt(card->priv->dev);
+       lbs_interrupt(card->priv);
 
        spin_unlock_irqrestore(&card->priv->driver_lock, flags);
 
index f59fd73468fcc72b34e46acd8097a30065f6eeea..1c23166783f4e3b68316c49a7dd0303bda240e81 100644 (file)
@@ -632,7 +632,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
               priv->upld_len);
 
        kfree_skb(skb);
-       lbs_interrupt(priv->dev);
+       lbs_interrupt(priv);
        spin_unlock(&priv->driver_lock);
 
        lbs_deb_usbd(&cardp->udev->dev,
@@ -705,7 +705,7 @@ static void if_usb_receive(struct urb *urb)
                cardp->usb_event_cause <<= 3;
                cardp->usb_int_cause |= MRVDRV_CARDEVENT;
                kfree_skb(skb);
-               lbs_interrupt(priv->dev);
+               lbs_interrupt(priv);
                spin_unlock(&priv->driver_lock);
                goto rx_exit;
        default:
index f16c93ba6efd3078aba8a5c32387140be8524082..2797149649ca0e5a4a2cf54c1d6a643ebf2edd01 100644 (file)
@@ -1408,23 +1408,22 @@ out:
  *  @param dev     A pointer to net_device structure
  *  @return       n/a
  */
-void lbs_interrupt(struct net_device *dev)
+void lbs_interrupt(struct lbs_private *priv)
 {
-       struct lbs_private *priv = dev->priv;
-
        lbs_deb_enter(LBS_DEB_THREAD);
 
-       lbs_deb_thread("lbs_interrupt: intcounter=%d\n",
-              priv->intcounter);
+       lbs_deb_thread("lbs_interrupt: intcounter=%d\n", priv->intcounter);
+
+       if (spin_trylock(&priv->driver_lock)) {
+               spin_unlock(&priv->driver_lock);
+               printk(KERN_CRIT "%s called without driver_lock held\n", __func__);
+               WARN_ON(1);
+       }
 
        priv->intcounter++;
 
-       if (priv->psstate == PS_STATE_SLEEP) {
+       if (priv->psstate == PS_STATE_SLEEP)
                priv->psstate = PS_STATE_AWAKE;
-               netif_wake_queue(dev);
-               if (priv->mesh_dev)
-                       netif_wake_queue(priv->mesh_dev);
-       }
 
        wake_up_interruptible(&priv->waitq);