diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-06 09:36:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:06:01 -0500 |
commit | e775ed7c677b163c80643036c32e23d3e59b9429 (patch) | |
tree | 909af580ca37910f462b613ba60a4e97e3035209 /drivers/net/wireless/libertas | |
parent | f5ece8fc8d3f5e36bda3554b74b0fbecb0a14309 (diff) |
libertas: Consolidate lbs_host_to_card_done() function.
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>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r-- | drivers/net/wireless/libertas/decl.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_cs.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_sdio.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 18 |
5 files changed, 27 insertions, 31 deletions
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h index 447297a5e686..201ec60f1dc5 100644 --- a/drivers/net/wireless/libertas/decl.h +++ b/drivers/net/wireless/libertas/decl.h | |||
@@ -86,5 +86,6 @@ int lbs_stop_card(struct lbs_private *priv); | |||
86 | int lbs_add_mesh(struct lbs_private *priv, struct device *dev); | 86 | int lbs_add_mesh(struct lbs_private *priv, struct device *dev); |
87 | void lbs_remove_mesh(struct lbs_private *priv); | 87 | void lbs_remove_mesh(struct lbs_private *priv); |
88 | int lbs_reset_device(struct lbs_private *priv); | 88 | int lbs_reset_device(struct lbs_private *priv); |
89 | void lbs_host_to_card_done(struct lbs_private *priv); | ||
89 | 90 | ||
90 | #endif | 91 | #endif |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 5fadcc03eea5..54b1ba3e250a 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -253,19 +253,13 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) | |||
253 | /* Not for us */ | 253 | /* Not for us */ |
254 | return IRQ_NONE; | 254 | return IRQ_NONE; |
255 | 255 | ||
256 | } else if(int_cause == 0xffff) { | 256 | } else if (int_cause == 0xffff) { |
257 | /* Read in junk, the card has probably been removed */ | 257 | /* Read in junk, the card has probably been removed */ |
258 | card->priv->adapter->surpriseremoved = 1; | 258 | card->priv->adapter->surpriseremoved = 1; |
259 | 259 | ||
260 | } else { | 260 | } else { |
261 | if(int_cause & IF_CS_H_IC_TX_OVER) { | 261 | if (int_cause & IF_CS_H_IC_TX_OVER) |
262 | card->priv->dnld_sent = DNLD_RES_RECEIVED; | 262 | lbs_host_to_card_done(card->priv); |
263 | if (!card->priv->adapter->cur_cmd) | ||
264 | wake_up_interruptible(&card->priv->waitq); | ||
265 | |||
266 | if (card->priv->adapter->connect_status == LBS_CONNECTED) | ||
267 | netif_wake_queue(card->priv->dev); | ||
268 | } | ||
269 | 263 | ||
270 | /* clear interrupt */ | 264 | /* clear interrupt */ |
271 | if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK); | 265 | if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK); |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 7a7037bdd37c..cccca311f75b 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -835,12 +835,9 @@ static void if_sdio_interrupt(struct sdio_func *func) | |||
835 | * Ignore the define name, this really means the card has | 835 | * Ignore the define name, this really means the card has |
836 | * successfully received the command. | 836 | * successfully received the command. |
837 | */ | 837 | */ |
838 | if (cause & IF_SDIO_H_INT_DNLD) { | 838 | if (cause & IF_SDIO_H_INT_DNLD) |
839 | if ((card->priv->dnld_sent == DNLD_DATA_SENT) && | 839 | lbs_host_to_card_done(card->priv); |
840 | (card->priv->adapter->connect_status == LBS_CONNECTED)) | 840 | |
841 | netif_wake_queue(card->priv->dev); | ||
842 | card->priv->dnld_sent = DNLD_RES_RECEIVED; | ||
843 | } | ||
844 | 841 | ||
845 | if (cause & IF_SDIO_H_INT_UPLD) { | 842 | if (cause & IF_SDIO_H_INT_UPLD) { |
846 | ret = if_sdio_card_to_host(card); | 843 | ret = if_sdio_card_to_host(card); |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index c27ffcfdbe88..418dcab8b1cc 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -66,22 +66,8 @@ static void if_usb_write_bulk_callback(struct urb *urb) | |||
66 | /* Used for both firmware TX and regular TX. priv isn't | 66 | /* Used for both firmware TX and regular TX. priv isn't |
67 | * valid at firmware load time. | 67 | * valid at firmware load time. |
68 | */ | 68 | */ |
69 | if (priv) { | 69 | if (priv) |
70 | struct lbs_adapter *adapter = priv->adapter; | 70 | lbs_host_to_card_done(priv); |
71 | struct net_device *dev = priv->dev; | ||
72 | |||
73 | priv->dnld_sent = DNLD_RES_RECEIVED; | ||
74 | |||
75 | /* Wake main thread if commands are pending */ | ||
76 | if (!adapter->cur_cmd) | ||
77 | wake_up_interruptible(&priv->waitq); | ||
78 | |||
79 | if (adapter->connect_status == LBS_CONNECTED) | ||
80 | netif_wake_queue(dev); | ||
81 | |||
82 | if (priv->mesh_dev && (adapter->mesh_connect_status == LBS_CONNECTED)) | ||
83 | netif_wake_queue(priv->mesh_dev); | ||
84 | } | ||
85 | } else { | 71 | } else { |
86 | /* print the failure status number for debug */ | 72 | /* print the failure status number for debug */ |
87 | lbs_pr_info("URB in failure status: %d\n", urb->status); | 73 | lbs_pr_info("URB in failure status: %d\n", urb->status); |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 67b6d7959e17..ed02c02c96da 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -616,6 +616,24 @@ static void lbs_tx_timeout(struct net_device *dev) | |||
616 | lbs_deb_leave(LBS_DEB_TX); | 616 | lbs_deb_leave(LBS_DEB_TX); |
617 | } | 617 | } |
618 | 618 | ||
619 | void lbs_host_to_card_done(struct lbs_private *priv) | ||
620 | { | ||
621 | struct lbs_adapter *adapter = priv->adapter; | ||
622 | |||
623 | priv->dnld_sent = DNLD_RES_RECEIVED; | ||
624 | |||
625 | /* Wake main thread if commands are pending */ | ||
626 | if (!adapter->cur_cmd) | ||
627 | wake_up_interruptible(&priv->waitq); | ||
628 | |||
629 | if (priv->dev && adapter->connect_status == LBS_CONNECTED) | ||
630 | netif_wake_queue(priv->dev); | ||
631 | |||
632 | if (priv->mesh_dev && adapter->mesh_connect_status == LBS_CONNECTED) | ||
633 | netif_wake_queue(priv->mesh_dev); | ||
634 | } | ||
635 | EXPORT_SYMBOL_GPL(lbs_host_to_card_done); | ||
636 | |||
619 | /** | 637 | /** |
620 | * @brief This function returns the network statistics | 638 | * @brief This function returns the network statistics |
621 | * | 639 | * |