From 1723047d6742cc172d5c0f1a5245deaee67ff331 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 7 Dec 2007 15:13:05 +0000 Subject: libertas: Switch to using a callback function pointer for commands Signed-off-by: David Woodhouse Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/cmdresp.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'drivers/net/wireless/libertas/cmdresp.c') 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); -- cgit v1.2.3