aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-10 13:36:10 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:34 -0500
commit1309b55b4de18bbfe19c73225a5481d6cdc8a463 (patch)
tree7993651309a0a35f8ec954fffa0b7b04003f9d32 /drivers/net/wireless/libertas
parentb6b8abe4ddec2cfb3471ea60f965a137cd4d529d (diff)
libertas: add opaque extra argument to cmd callback function
This will be useful for letting callbacks do stuff like copying the response into a buffer provided by the caller of lbs_cmd() 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/cmd.c6
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c11
-rw-r--r--drivers/net/wireless/libertas/decl.h3
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h3
-rw-r--r--drivers/net/wireless/libertas/if_usb.c2
5 files changed, 16 insertions, 9 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 49a9aeee2b6a..228e3fee20fb 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1642,6 +1642,7 @@ static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
1642 ptempnode->wait_option = 0; 1642 ptempnode->wait_option = 0;
1643 ptempnode->pdata_buf = NULL; 1643 ptempnode->pdata_buf = NULL;
1644 ptempnode->callback = NULL; 1644 ptempnode->callback = NULL;
1645 ptempnode->callback_arg = 0;
1645 1646
1646 if (ptempnode->bufvirtualaddr != NULL) 1647 if (ptempnode->bufvirtualaddr != NULL)
1647 memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER); 1648 memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
@@ -1670,6 +1671,7 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
1670 ptempnode->wait_option = wait_option; 1671 ptempnode->wait_option = wait_option;
1671 ptempnode->pdata_buf = pdata_buf; 1672 ptempnode->pdata_buf = pdata_buf;
1672 ptempnode->callback = NULL; 1673 ptempnode->callback = NULL;
1674 ptempnode->callback_arg = 0;
1673 1675
1674 lbs_deb_leave(LBS_DEB_HOST); 1676 lbs_deb_leave(LBS_DEB_HOST);
1675} 1677}
@@ -1993,7 +1995,8 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
1993 */ 1995 */
1994 1996
1995int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, 1997int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
1996 int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *)) 1998 int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *),
1999 unsigned long callback_arg)
1997{ 2000{
1998 struct cmd_ctrl_node *cmdnode; 2001 struct cmd_ctrl_node *cmdnode;
1999 struct cmd_ds_gen *cmdptr; 2002 struct cmd_ds_gen *cmdptr;
@@ -2028,6 +2031,7 @@ int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
2028 cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr; 2031 cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr;
2029 cmdnode->wait_option = CMD_OPTION_WAITFORRSP; 2032 cmdnode->wait_option = CMD_OPTION_WAITFORRSP;
2030 cmdnode->callback = callback; 2033 cmdnode->callback = callback;
2034 cmdnode->callback_arg = callback_arg;
2031 2035
2032 /* Set sequence number, clean result, move to buffer */ 2036 /* Set sequence number, clean result, move to buffer */
2033 priv->seqnum++; 2037 priv->seqnum++;
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index ab6e729efacf..7bad257fd9cb 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -552,12 +552,13 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv,
552 return 0; 552 return 0;
553} 553}
554 554
555static inline int handle_cmd_response(u16 respcmd, 555static inline int handle_cmd_response(struct lbs_private *priv,
556 struct cmd_ds_command *resp, 556 unsigned long dummy,
557 struct lbs_private *priv) 557 struct cmd_ds_command *resp)
558{ 558{
559 int ret = 0; 559 int ret = 0;
560 unsigned long flags; 560 unsigned long flags;
561 uint16_t respcmd = le16_to_cpu(resp->command);
561 562
562 lbs_deb_enter(LBS_DEB_HOST); 563 lbs_deb_enter(LBS_DEB_HOST);
563 564
@@ -861,9 +862,9 @@ int lbs_process_rx_command(struct lbs_private *priv)
861 spin_unlock_irqrestore(&priv->driver_lock, flags); 862 spin_unlock_irqrestore(&priv->driver_lock, flags);
862 863
863 if (priv->cur_cmd && priv->cur_cmd->callback) 864 if (priv->cur_cmd && priv->cur_cmd->callback)
864 ret = priv->cur_cmd->callback(respcmd, resp, priv); 865 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, resp);
865 else 866 else
866 ret = handle_cmd_response(respcmd, resp, priv); 867 ret = handle_cmd_response(priv, 0, resp);
867 868
868 spin_lock_irqsave(&priv->driver_lock, flags); 869 spin_lock_irqsave(&priv->driver_lock, flags);
869 870
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index e8387c7ec02a..a086d0c6dfed 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -24,7 +24,8 @@ void lbs_send_tx_feedback(struct lbs_private *priv);
24int lbs_free_cmd_buffer(struct lbs_private *priv); 24int lbs_free_cmd_buffer(struct lbs_private *priv);
25 25
26int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, 26int lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
27 int (*callback)(uint16_t, struct cmd_ds_command *, struct lbs_private *)); 27 int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *),
28 unsigned long callback_arg);
28 29
29int lbs_prepare_and_send_command(struct lbs_private *priv, 30int lbs_prepare_and_send_command(struct lbs_private *priv,
30 u16 cmd_no, 31 u16 cmd_no,
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index f1c1d3f106c8..ed502b74fa3c 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -71,7 +71,8 @@ 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 (*callback)(uint16_t respcmd, struct cmd_ds_command *resp, struct lbs_private *priv); 74 int (*callback)(struct lbs_private *priv, unsigned long arg, struct cmd_ds_command *resp);
75 unsigned long callback_arg;
75 /* command data */ 76 /* command data */
76 u8 *bufvirtualaddr; 77 u8 *bufvirtualaddr;
77 /* wait queue */ 78 /* wait queue */
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 141d185ac01b..f59fd73468fc 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -108,7 +108,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv)
108 b2_cmd.action = 0; 108 b2_cmd.action = 0;
109 b2_cmd.version = priv->boot2_version; 109 b2_cmd.version = priv->boot2_version;
110 110
111 if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), NULL)) 111 if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, sizeof(b2_cmd), NULL, 0))
112 lbs_deb_usb("Setting boot2 version failed\n"); 112 lbs_deb_usb("Setting boot2 version failed\n");
113} 113}
114 114