diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-17 15:22:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:07:44 -0500 |
commit | 7003b078c82d141216deecef4de154711a107aab (patch) | |
tree | de77a9a0c8cdb792200ac757f7c454384c06128c /drivers | |
parent | ac4cced6e850496b66c0825b7f74d51ef02c6371 (diff) |
libertas: use priv->upld_buf for command responses
If we don't scribble over the command we sent, then we can retry it when
the firmware responds with 0x0004 (which means -EAGAIN).
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_cs.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_sdio.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 14 |
4 files changed, 4 insertions, 30 deletions
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index d305e982c502..4d384612afa7 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -639,7 +639,7 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
639 | goto done; | 639 | goto done; |
640 | } | 640 | } |
641 | 641 | ||
642 | resp = priv->cur_cmd->cmdbuf; | 642 | resp = (void *)priv->upld_buf; |
643 | 643 | ||
644 | curcmd = le16_to_cpu(resp->command); | 644 | curcmd = le16_to_cpu(resp->command); |
645 | 645 | ||
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 58143637c737..4b5ab9a6b97b 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -647,7 +647,6 @@ static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg) | |||
647 | struct if_cs_card *card = (struct if_cs_card *)priv->card; | 647 | struct if_cs_card *card = (struct if_cs_card *)priv->card; |
648 | int ret = 0; | 648 | int ret = 0; |
649 | u16 int_cause; | 649 | u16 int_cause; |
650 | u8 *cmdbuf; | ||
651 | *ireg = 0; | 650 | *ireg = 0; |
652 | 651 | ||
653 | lbs_deb_enter(LBS_DEB_CS); | 652 | lbs_deb_enter(LBS_DEB_CS); |
@@ -679,14 +678,7 @@ sbi_get_int_status_exit: | |||
679 | /* Card has a command result for us */ | 678 | /* Card has a command result for us */ |
680 | if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) { | 679 | if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) { |
681 | spin_lock(&priv->driver_lock); | 680 | spin_lock(&priv->driver_lock); |
682 | if (!priv->cur_cmd) { | 681 | ret = if_cs_receive_cmdres(priv, priv->upld_buf, &priv->upld_len); |
683 | cmdbuf = priv->upld_buf; | ||
684 | priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY; | ||
685 | } else { | ||
686 | cmdbuf = (u8 *) priv->cur_cmd->cmdbuf; | ||
687 | } | ||
688 | |||
689 | ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len); | ||
690 | spin_unlock(&priv->driver_lock); | 682 | spin_unlock(&priv->driver_lock); |
691 | if (ret < 0) | 683 | if (ret < 0) |
692 | lbs_pr_err("could not receive cmd from card\n"); | 684 | lbs_pr_err("could not receive cmd from card\n"); |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 9225546b9d48..eed73204bcc9 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -136,12 +136,6 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, | |||
136 | 136 | ||
137 | spin_lock_irqsave(&card->priv->driver_lock, flags); | 137 | spin_lock_irqsave(&card->priv->driver_lock, flags); |
138 | 138 | ||
139 | if (!card->priv->cur_cmd) { | ||
140 | lbs_deb_sdio("discarding spurious response\n"); | ||
141 | ret = 0; | ||
142 | goto out; | ||
143 | } | ||
144 | |||
145 | if (size > LBS_CMD_BUFFER_SIZE) { | 139 | if (size > LBS_CMD_BUFFER_SIZE) { |
146 | lbs_deb_sdio("response packet too large (%d bytes)\n", | 140 | lbs_deb_sdio("response packet too large (%d bytes)\n", |
147 | (int)size); | 141 | (int)size); |
@@ -149,7 +143,7 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, | |||
149 | goto out; | 143 | goto out; |
150 | } | 144 | } |
151 | 145 | ||
152 | memcpy(card->priv->cur_cmd->cmdbuf, buffer, size); | 146 | memcpy(card->priv->upld_buf, buffer, size); |
153 | card->priv->upld_len = size; | 147 | card->priv->upld_len = size; |
154 | 148 | ||
155 | card->int_cause |= MRVDRV_CMD_UPLD_RDY; | 149 | card->int_cause |= MRVDRV_CMD_UPLD_RDY; |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 3931fe6267ce..7db8e6c35dc2 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -589,8 +589,6 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, | |||
589 | struct if_usb_card *cardp, | 589 | struct if_usb_card *cardp, |
590 | struct lbs_private *priv) | 590 | struct lbs_private *priv) |
591 | { | 591 | { |
592 | uint8_t *cmdbuf; | ||
593 | |||
594 | if (recvlength > LBS_CMD_BUFFER_SIZE) { | 592 | if (recvlength > LBS_CMD_BUFFER_SIZE) { |
595 | lbs_deb_usbd(&cardp->udev->dev, | 593 | lbs_deb_usbd(&cardp->udev->dev, |
596 | "The receive buffer is too large\n"); | 594 | "The receive buffer is too large\n"); |
@@ -602,19 +600,9 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, | |||
602 | BUG(); | 600 | BUG(); |
603 | 601 | ||
604 | spin_lock(&priv->driver_lock); | 602 | spin_lock(&priv->driver_lock); |
605 | /* take care of cur_cmd = NULL case by reading the | ||
606 | * data to clear the interrupt */ | ||
607 | if (!priv->cur_cmd) { | ||
608 | lbs_deb_hex(LBS_DEB_HOST, "Unsolicited CMD_RESP", | ||
609 | (void *) recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); | ||
610 | cmdbuf = priv->upld_buf; | ||
611 | priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; | ||
612 | } else | ||
613 | cmdbuf = (uint8_t *) priv->cur_cmd->cmdbuf; | ||
614 | |||
615 | cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY; | 603 | cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY; |
616 | priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); | 604 | priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); |
617 | memcpy(cmdbuf, recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); | 605 | memcpy(priv->upld_buf, recvbuff + MESSAGE_HEADER_LEN, priv->upld_len); |
618 | 606 | ||
619 | kfree_skb(skb); | 607 | kfree_skb(skb); |
620 | lbs_interrupt(priv); | 608 | lbs_interrupt(priv); |