Commit e775ed7c authored by David Woodhouse's avatar David Woodhouse Committed by David S. Miller

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: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f5ece8fc
...@@ -86,5 +86,6 @@ int lbs_stop_card(struct lbs_private *priv); ...@@ -86,5 +86,6 @@ int lbs_stop_card(struct lbs_private *priv);
int lbs_add_mesh(struct lbs_private *priv, struct device *dev); int lbs_add_mesh(struct lbs_private *priv, struct device *dev);
void lbs_remove_mesh(struct lbs_private *priv); void lbs_remove_mesh(struct lbs_private *priv);
int lbs_reset_device(struct lbs_private *priv); int lbs_reset_device(struct lbs_private *priv);
void lbs_host_to_card_done(struct lbs_private *priv);
#endif #endif
...@@ -253,19 +253,13 @@ static irqreturn_t if_cs_interrupt(int irq, void *data) ...@@ -253,19 +253,13 @@ static irqreturn_t if_cs_interrupt(int irq, void *data)
/* Not for us */ /* Not for us */
return IRQ_NONE; return IRQ_NONE;
} else if(int_cause == 0xffff) { } else if (int_cause == 0xffff) {
/* Read in junk, the card has probably been removed */ /* Read in junk, the card has probably been removed */
card->priv->adapter->surpriseremoved = 1; card->priv->adapter->surpriseremoved = 1;
} else { } else {
if(int_cause & IF_CS_H_IC_TX_OVER) { if (int_cause & IF_CS_H_IC_TX_OVER)
card->priv->dnld_sent = DNLD_RES_RECEIVED; lbs_host_to_card_done(card->priv);
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);
}
/* clear interrupt */ /* clear interrupt */
if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK); if_cs_write16(card, IF_CS_C_INT_CAUSE, int_cause & IF_CS_C_IC_MASK);
......
...@@ -835,12 +835,9 @@ static void if_sdio_interrupt(struct sdio_func *func) ...@@ -835,12 +835,9 @@ static void if_sdio_interrupt(struct sdio_func *func)
* Ignore the define name, this really means the card has * Ignore the define name, this really means the card has
* successfully received the command. * successfully received the command.
*/ */
if (cause & IF_SDIO_H_INT_DNLD) { if (cause & IF_SDIO_H_INT_DNLD)
if ((card->priv->dnld_sent == DNLD_DATA_SENT) && lbs_host_to_card_done(card->priv);
(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_UPLD) { if (cause & IF_SDIO_H_INT_UPLD) {
ret = if_sdio_card_to_host(card); ret = if_sdio_card_to_host(card);
......
...@@ -66,22 +66,8 @@ static void if_usb_write_bulk_callback(struct urb *urb) ...@@ -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 /* Used for both firmware TX and regular TX. priv isn't
* valid at firmware load time. * valid at firmware load time.
*/ */
if (priv) { if (priv)
struct lbs_adapter *adapter = priv->adapter; lbs_host_to_card_done(priv);
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);
}
} else { } else {
/* print the failure status number for debug */ /* print the failure status number for debug */
lbs_pr_info("URB in failure status: %d\n", urb->status); lbs_pr_info("URB in failure status: %d\n", urb->status);
......
...@@ -616,6 +616,24 @@ static void lbs_tx_timeout(struct net_device *dev) ...@@ -616,6 +616,24 @@ static void lbs_tx_timeout(struct net_device *dev)
lbs_deb_leave(LBS_DEB_TX); 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 * @brief This function returns the network statistics
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment