]> err.no Git - linux-2.6/commitdiff
libertas: Consolidate lbs_host_to_card_done() function.
authorDavid Woodhouse <dwmw2@infradead.org>
Thu, 6 Dec 2007 14:36:11 +0000 (14:36 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:06:01 +0000 (15:06 -0800)
As we move towards having this done by a state machine, start by having
a single 'stuff sent' function, which is called by if_usb/if_sdio/if_cs
after sending both data and commands.

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 447297a5e6861bf7fe1d9e6d0a5e0a9ea7311359..201ec60f1dc567111f91c587214f5653c4c4343b 100644 (file)
@@ -86,5 +86,6 @@ int lbs_stop_card(struct lbs_private *priv);
 int lbs_add_mesh(struct lbs_private *priv, struct device *dev);
 void lbs_remove_mesh(struct lbs_private *priv);
 int lbs_reset_device(struct lbs_private *priv);
+void lbs_host_to_card_done(struct lbs_private *priv);
 
 #endif
index 5fadcc03eea5887cd05097abab37c4dd53d2c8a1..54b1ba3e250a68f249888d5b7a8fa640b0618f4a 100644 (file)
@@ -253,19 +253,13 @@ static irqreturn_t if_cs_interrupt(int irq, void *data)
                /* Not for us */
                return IRQ_NONE;
 
-       } else if(int_cause == 0xffff) {
+       } else if (int_cause == 0xffff) {
                /* Read in junk, the card has probably been removed */
                card->priv->adapter->surpriseremoved = 1;
 
        } else {
-               if(int_cause & IF_CS_H_IC_TX_OVER) {
-                       card->priv->dnld_sent = DNLD_RES_RECEIVED;
-                       if (!card->priv->adapter->cur_cmd)
-                               wake_up_interruptible(&card->priv->waitq);
-
-                       if (card->priv->adapter->connect_status == LBS_CONNECTED)
-                               netif_wake_queue(card->priv->dev);
-               }
+               if (int_cause & IF_CS_H_IC_TX_OVER)
+                       lbs_host_to_card_done(card->priv);
 
                /* clear interrupt */
                if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK);
index 7a7037bdd37cc88333a02e3e6c8701ec9209b2ab..cccca311f75bb77ef0a5ea721d1041da8a1d99a8 100644 (file)
@@ -835,12 +835,9 @@ static void if_sdio_interrupt(struct sdio_func *func)
         * Ignore the define name, this really means the card has
         * successfully received the command.
         */
-       if (cause & IF_SDIO_H_INT_DNLD) {
-               if ((card->priv->dnld_sent == DNLD_DATA_SENT) &&
-                       (card->priv->adapter->connect_status == LBS_CONNECTED))
-                       netif_wake_queue(card->priv->dev);
-               card->priv->dnld_sent = DNLD_RES_RECEIVED;
-       }
+       if (cause & IF_SDIO_H_INT_DNLD)
+               lbs_host_to_card_done(card->priv);
+
 
        if (cause & IF_SDIO_H_INT_UPLD) {
                ret = if_sdio_card_to_host(card);
index c27ffcfdbe88d67107a3aa141d13541715ccd3c3..418dcab8b1cc48cb3ec9732c59d9eec344628704 100644 (file)
@@ -66,22 +66,8 @@ static void if_usb_write_bulk_callback(struct urb *urb)
                /* Used for both firmware TX and regular TX.  priv isn't
                 * valid at firmware load time.
                 */
-               if (priv) {
-                       struct lbs_adapter *adapter = priv->adapter;
-                       struct net_device *dev = priv->dev;
-
-                       priv->dnld_sent = DNLD_RES_RECEIVED;
-
-                       /* Wake main thread if commands are pending */
-                       if (!adapter->cur_cmd)
-                               wake_up_interruptible(&priv->waitq);
-
-                       if (adapter->connect_status == LBS_CONNECTED)
-                               netif_wake_queue(dev);
-
-                       if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED))
-                               netif_wake_queue(priv->mesh_dev);
-               }
+               if (priv)
+                       lbs_host_to_card_done(priv);
        } else {
                /* print the failure status number for debug */
                lbs_pr_info("URB in failure status: %d\n", urb->status);
index 67b6d7959e176c8a7a0386fda97a6345f738e6a3..ed02c02c96da0ddb738db62d1a1901d68c948e2f 100644 (file)
@@ -616,6 +616,24 @@ static void lbs_tx_timeout(struct net_device *dev)
        lbs_deb_leave(LBS_DEB_TX);
 }
 
+void lbs_host_to_card_done(struct lbs_private *priv)
+{
+       struct lbs_adapter *adapter = priv->adapter;
+
+       priv->dnld_sent = DNLD_RES_RECEIVED;
+
+       /* Wake main thread if commands are pending */
+       if (!adapter->cur_cmd)
+               wake_up_interruptible(&priv->waitq);
+
+       if (priv->dev && adapter->connect_status == LBS_CONNECTED)
+               netif_wake_queue(priv->dev);
+
+       if (priv->mesh_dev && adapter->mesh_connect_status == LBS_CONNECTED)
+               netif_wake_queue(priv->mesh_dev);
+}
+EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
+
 /**
  *  @brief This function returns the network statistics
  *