aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/cmd.c30
-rw-r--r--drivers/net/wireless/libertas/decl.h6
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h1
-rw-r--r--drivers/net/wireless/libertas/if_usb.c5
4 files changed, 7 insertions, 35 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 092c295e3802..6838c9cd856e 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1657,7 +1657,6 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
1657 wake_up_interruptible(&ptempnode->cmdwait_q); 1657 wake_up_interruptible(&ptempnode->cmdwait_q);
1658 ptempnode->wait_option = 0; 1658 ptempnode->wait_option = 0;
1659 ptempnode->pdata_buf = NULL; 1659 ptempnode->pdata_buf = NULL;
1660 ptempnode->pdata_size = NULL;
1661 ptempnode->callback = NULL; 1660 ptempnode->callback = NULL;
1662 1661
1663 if (ptempnode->bufvirtualaddr != NULL) 1662 if (ptempnode->bufvirtualaddr != NULL)
@@ -1686,7 +1685,6 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
1686 1685
1687 ptempnode->wait_option = wait_option; 1686 ptempnode->wait_option = wait_option;
1688 ptempnode->pdata_buf = pdata_buf; 1687 ptempnode->pdata_buf = pdata_buf;
1689 ptempnode->pdata_size = NULL;
1690 ptempnode->callback = NULL; 1688 ptempnode->callback = NULL;
1691 1689
1692 lbs_deb_leave(LBS_DEB_HOST); 1690 lbs_deb_leave(LBS_DEB_HOST);
@@ -2013,25 +2011,8 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
2013 * the result code from the firmware 2011 * the result code from the firmware
2014 */ 2012 */
2015 2013
2016static int lbs_cmd_callback(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv) 2014int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
2017{ 2015 int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *))
2018 struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp;
2019 struct lbs_adapter *adapter = priv->adapter;
2020 u16 sz = le16_to_cpu(resp->size) - S_DS_GEN;
2021
2022 if (sz > *adapter->cur_cmd->pdata_size) {
2023 lbs_pr_err("response 0x%04x doesn't fit into buffer (%d > %d)\n",
2024 respcmd, sz, *adapter->cur_cmd->pdata_size);
2025 sz = *adapter->cur_cmd->pdata_size;
2026 }
2027 memcpy(adapter->cur_cmd->pdata_buf, r->cmdresp, sz);
2028 *adapter->cur_cmd->pdata_size = sz;
2029
2030 return 0;
2031}
2032
2033int lbs_cmd(struct lbs_private *priv, u16 command, void *cmd, int cmd_size,
2034 void *rsp, int *rsp_size)
2035{ 2016{
2036 struct lbs_adapter *adapter = priv->adapter; 2017 struct lbs_adapter *adapter = priv->adapter;
2037 struct cmd_ctrl_node *cmdnode; 2018 struct cmd_ctrl_node *cmdnode;
@@ -2040,9 +2021,8 @@ int lbs_cmd(struct lbs_private *priv, u16 command, void *cmd, int cmd_size,
2040 int ret = 0; 2021 int ret = 0;
2041 2022
2042 lbs_deb_enter(LBS_DEB_HOST); 2023 lbs_deb_enter(LBS_DEB_HOST);
2043 lbs_deb_host("rsp at %p, rsp_size at %p\n", rsp, rsp_size);
2044 2024
2045 if (!adapter || !rsp_size) { 2025 if (!adapter) {
2046 lbs_deb_host("PREP_CMD: adapter is NULL\n"); 2026 lbs_deb_host("PREP_CMD: adapter is NULL\n");
2047 ret = -1; 2027 ret = -1;
2048 goto done; 2028 goto done;
@@ -2067,9 +2047,7 @@ int lbs_cmd(struct lbs_private *priv, u16 command, void *cmd, int cmd_size,
2067 2047
2068 cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr; 2048 cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr;
2069 cmdnode->wait_option = CMD_OPTION_WAITFORRSP; 2049 cmdnode->wait_option = CMD_OPTION_WAITFORRSP;
2070 cmdnode->pdata_buf = rsp; 2050 cmdnode->callback = callback;
2071 cmdnode->pdata_size = rsp_size;
2072 cmdnode->callback = lbs_cmd_callback;
2073 2051
2074 /* Set sequence number, clean result, move to buffer */ 2052 /* Set sequence number, clean result, move to buffer */
2075 adapter->seqnum++; 2053 adapter->seqnum++;
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 6f47ff089622..1a8fdaa7375c 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -24,10 +24,8 @@ void lbs_send_tx_feedback(struct lbs_private *priv);
24 24
25int lbs_free_cmd_buffer(struct lbs_private *priv); 25int lbs_free_cmd_buffer(struct lbs_private *priv);
26 26
27int lbs_cmd(struct lbs_private *priv, 27int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
28 u16 command, 28 int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *));
29 void *cmd, int cmd_size,
30 void *resp, int *resp_size);
31 29
32int lbs_prepare_and_send_command(struct lbs_private *priv, 30int lbs_prepare_and_send_command(struct lbs_private *priv,
33 u16 cmd_no, 31 u16 cmd_no,
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index efdb720d9fe7..f1c1d3f106c8 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -71,7 +71,6 @@ struct cmd_ctrl_node {
71 u16 wait_option; 71 u16 wait_option;
72 /* command response */ 72 /* command response */
73 void *pdata_buf; 73 void *pdata_buf;
74 int *pdata_size;
75 int (*callback)(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv); 74 int (*callback)(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv);
76 /* command data */ 75 /* command data */
77 u8 *bufvirtualaddr; 76 u8 *bufvirtualaddr;
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index a17371fe2fe4..7c4bd8d982a5 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -104,15 +104,12 @@ static void if_usb_free(struct usb_card_rec *cardp)
104static void if_usb_set_boot2_ver(struct lbs_private *priv) 104static void if_usb_set_boot2_ver(struct lbs_private *priv)
105{ 105{
106 struct cmd_ds_set_boot2_ver b2_cmd; 106 struct cmd_ds_set_boot2_ver b2_cmd;
107 int rsp_len = sizeof(b2_cmd);
108 107
109 b2_cmd.action = 0; 108 b2_cmd.action = 0;
110 b2_cmd.version = priv->boot2_version; 109 b2_cmd.version = priv->boot2_version;
111 110
112 if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), 111 if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), NULL))
113 &b2_cmd, &rsp_len)) {
114 lbs_deb_usb("Setting boot2 version failed\n"); 112 lbs_deb_usb("Setting boot2 version failed\n");
115 }
116} 113}
117 114
118 115