diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-07 15:13:05 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:06:12 -0800 |
commit | 1723047d6742cc172d5c0f1a5245deaee67ff331 (patch) | |
tree | 5285bceb2683c7c69249bf77b0a70fe1bb9d3729 /drivers/net/wireless/libertas/cmdresp.c | |
parent | 0856e6816b30a84aa74c70ecb2bde0c41402f647 (diff) |
libertas: Switch to using a callback function pointer for commands
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.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 22a69736338..20ca38c7f87 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -880,22 +880,15 @@ int lbs_process_rx_command(struct lbs_private *priv) goto done; } - if (adapter->cur_cmd->pdata_size) { - struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp; - u16 sz = cpu_to_le16(resp->size) - S_DS_GEN; - if (sz > *adapter->cur_cmd->pdata_size) { - lbs_pr_err("response 0x%04x doesn't fit into " - "buffer (%d > %d)\n", respcmd, - sz, *adapter->cur_cmd->pdata_size); - sz = *adapter->cur_cmd->pdata_size; - } - memcpy(adapter->cur_cmd->pdata_buf, r->cmdresp, sz); - *adapter->cur_cmd->pdata_size = sz; - } else { - spin_unlock_irqrestore(&adapter->driver_lock, flags); + spin_unlock_irqrestore(&adapter->driver_lock, flags); + + if (adapter->cur_cmd && adapter->cur_cmd->callback) + ret = adapter->cur_cmd->callback(respcmd, resp, priv); + else ret = handle_cmd_response(respcmd, resp, priv); - spin_lock_irqsave(&adapter->driver_lock, flags); - } + + spin_lock_irqsave(&adapter->driver_lock, flags); + if (adapter->cur_cmd) { /* Clean up and Put current command back to cmdfreeq */ __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); |