aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmd.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-12-11 12:33:30 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:41 -0500
commit7ad994dec7d36c319cb35cbf3a920d3bda96e6b0 (patch)
treeb186f3896514d34a86438b61bf3770fde0e4d960 /drivers/net/wireless/libertas/cmd.c
parentb15152a4033d4c82015bb79c6b81eeb0a2edeeea (diff)
libertas: clean up direct command handling
Move direct command handling through __lbs_cmd() over to using the header as the first member of the command structure, and only define the __lbs_cmd() callback in one place rather than 3. Convert boot2 version command to new usage. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r--drivers/net/wireless/libertas/cmd.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 2efba5708041..78870c770428 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1988,12 +1988,13 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
1988 * the result code from the firmware 1988 * the result code from the firmware
1989 */ 1989 */
1990 1990
1991int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, 1991int __lbs_cmd(struct lbs_private *priv, uint16_t command,
1992 int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *), 1992 struct cmd_header *in_cmd, int in_cmd_size,
1993 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
1993 unsigned long callback_arg) 1994 unsigned long callback_arg)
1994{ 1995{
1995 struct cmd_ctrl_node *cmdnode; 1996 struct cmd_ctrl_node *cmdnode;
1996 struct cmd_ds_gen *cmdptr; 1997 struct cmd_header *send_cmd;
1997 unsigned long flags; 1998 unsigned long flags;
1998 int ret = 0; 1999 int ret = 0;
1999 2000
@@ -2012,7 +2013,6 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_siz
2012 } 2013 }
2013 2014
2014 cmdnode = lbs_get_cmd_ctrl_node(priv); 2015 cmdnode = lbs_get_cmd_ctrl_node(priv);
2015
2016 if (cmdnode == NULL) { 2016 if (cmdnode == NULL) {
2017 lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); 2017 lbs_deb_host("PREP_CMD: cmdnode is NULL\n");
2018 2018
@@ -2022,18 +2022,20 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_siz
2022 goto done; 2022 goto done;
2023 } 2023 }
2024 2024
2025 cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr; 2025 send_cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
2026 cmdnode->wait_option = CMD_OPTION_WAITFORRSP; 2026 cmdnode->wait_option = CMD_OPTION_WAITFORRSP;
2027 cmdnode->callback = callback; 2027 cmdnode->callback = callback;
2028 cmdnode->callback_arg = callback_arg; 2028 cmdnode->callback_arg = callback_arg;
2029 2029
2030 /* Copy the incoming command to the buffer */
2031 memcpy(send_cmd, in_cmd, in_cmd_size);
2032
2030 /* Set sequence number, clean result, move to buffer */ 2033 /* Set sequence number, clean result, move to buffer */
2031 priv->seqnum++; 2034 priv->seqnum++;
2032 cmdptr->command = cpu_to_le16(command); 2035 send_cmd->command = cpu_to_le16(command);
2033 cmdptr->size = cpu_to_le16(cmd_size + S_DS_GEN); 2036 send_cmd->size = cpu_to_le16(in_cmd_size);
2034 cmdptr->seqnum = cpu_to_le16(priv->seqnum); 2037 send_cmd->seqnum = cpu_to_le16(priv->seqnum);
2035 cmdptr->result = 0; 2038 send_cmd->result = 0;
2036 memcpy(cmdptr->cmdresp, cmd, cmd_size);
2037 2039
2038 lbs_deb_host("PREP_CMD: command 0x%04x\n", command); 2040 lbs_deb_host("PREP_CMD: command 0x%04x\n", command);
2039 2041