aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmdresp.c
diff options
context:
space:
mode:
authorHolger Schurig <h.schurig@mn-solutions.de>2007-12-05 11:58:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:04 -0500
commit675787e29fd97d08bf7e6253c89ab6de23bf7089 (patch)
tree81a51dd6696e5ba67a87e6b4bf2ee368854f23b7 /drivers/net/wireless/libertas/cmdresp.c
parent0d61d04210b617963c202a3c4dcbcd26a024d5d3 (diff)
libertas: handy function to call firmware commands
Using an arbitrary firmware command was actually very painful. One had to change big switch() statements in cmd.c, cmdresp.c, add structs to the big union in "struct cmd_ds_command" and add the define for the CMD_802_11_xxx to the proper place. With this function, this is now much easier. For now, it implements a blocking (a.k.a. CMD_OPTION_WAITFORRSP) way where one deals directly with command requests and response buffers. You can do everything in one place: Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmdresp.c')
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index cbd28ee7c5b8..6a43de772aa0 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -799,7 +799,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
799 } 799 }
800 800
801 /* Store the response code to cur_cmd_retcode. */ 801 /* Store the response code to cur_cmd_retcode. */
802 adapter->cur_cmd_retcode = result;; 802 adapter->cur_cmd_retcode = result;
803 803
804 if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { 804 if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
805 struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; 805 struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
@@ -880,11 +880,22 @@ int lbs_process_rx_command(struct lbs_private *priv)
880 goto done; 880 goto done;
881 } 881 }
882 882
883 spin_unlock_irqrestore(&adapter->driver_lock, flags); 883 if (adapter->cur_cmd->pdata_size) {
884 884 struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp;
885 ret = handle_cmd_response(respcmd, resp, priv); 885 u16 sz = cpu_to_le16(resp->size);
886 886 if (sz > *adapter->cur_cmd->pdata_size) {
887 spin_lock_irqsave(&adapter->driver_lock, flags); 887 lbs_pr_err("response 0x%04x doesn't fit into "
888 "buffer (%d > %d)\n", respcmd,
889 sz, *adapter->cur_cmd->pdata_size);
890 sz = *adapter->cur_cmd->pdata_size;
891 }
892 memcpy(adapter->cur_cmd->pdata_buf, r->cmdresp, sz);
893 *adapter->cur_cmd->pdata_size = sz;
894 } else {
895 spin_unlock_irqrestore(&adapter->driver_lock, flags);
896 ret = handle_cmd_response(respcmd, resp, priv);
897 spin_lock_irqsave(&adapter->driver_lock, flags);
898 }
888 if (adapter->cur_cmd) { 899 if (adapter->cur_cmd) {
889 /* Clean up and Put current command back to cmdfreeq */ 900 /* Clean up and Put current command back to cmdfreeq */
890 __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 901 __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd);