aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-09-20 15:37:23 -0700
committerJohn W. Linville <linville@tuxdriver.com>2011-09-21 16:19:42 -0400
commit247c61d625154e18a105d663281c52376a882762 (patch)
treeec06a3824fda8a119cef3f7338826b4d25eee656 /drivers/net/wireless/iwlwifi/iwl-sta.c
parentiwlagn: split remain-on-channel (diff)
downloadlinux-dev-247c61d625154e18a105d663281c52376a882762.tar.xz
linux-dev-247c61d625154e18a105d663281c52376a882762.zip
iwlagn: remove the callback in host commands
Before this patch, the upper layer could register a callback for each host command. This mechanism allowed the upper layer to have different callbacks for the same command ID. In fact, it wasn't used and the rx_handlers is enough: same callback for all the command with a specific command ID. The iwl_send_add_station needs the access the command that was sent while handling the response (regardless if the command was sent in SYNC or ASYNC mode). So now, all the handlers receive the host command that was sent. This implies a change in the handler signature. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index f35cfa2fe5c5..7028f907e600 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -59,8 +59,7 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
static int iwl_process_add_sta_resp(struct iwl_priv *priv,
struct iwl_addsta_cmd *addsta,
- struct iwl_rx_packet *pkt,
- bool sync)
+ struct iwl_rx_packet *pkt)
{
u8 sta_id = addsta->sta.sta_id;
unsigned long flags;
@@ -123,15 +122,14 @@ static int iwl_process_add_sta_resp(struct iwl_priv *priv,
return ret;
}
-static void iwl_add_sta_callback(struct iwl_shared *shrd,
- struct iwl_device_cmd *cmd,
- struct iwl_rx_packet *pkt)
+int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb,
+ struct iwl_device_cmd *cmd)
{
+ struct iwl_rx_packet *pkt = rxb_addr(rxb);
struct iwl_addsta_cmd *addsta =
(struct iwl_addsta_cmd *)cmd->cmd.payload;
- iwl_process_add_sta_resp(shrd->priv, addsta, pkt, false);
-
+ return iwl_process_add_sta_resp(priv, addsta, pkt);
}
static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
@@ -147,7 +145,6 @@ static u16 iwlagn_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
int iwl_send_add_sta(struct iwl_priv *priv,
struct iwl_addsta_cmd *sta, u8 flags)
{
- struct iwl_rx_packet *pkt = NULL;
int ret = 0;
u8 data[sizeof(*sta)];
struct iwl_host_cmd cmd = {
@@ -160,9 +157,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n",
sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : "");
- if (flags & CMD_ASYNC)
- cmd.callback = iwl_add_sta_callback;
- else {
+ if (!(flags & CMD_ASYNC)) {
cmd.flags |= CMD_WANT_SKB;
might_sleep();
}
@@ -172,14 +167,16 @@ int iwl_send_add_sta(struct iwl_priv *priv,
if (ret || (flags & CMD_ASYNC))
return ret;
+ /*else the command was successfully sent in SYNC mode, need to free
+ * the reply page */
- if (ret == 0) {
- pkt = (struct iwl_rx_packet *)cmd.reply_page;
- ret = iwl_process_add_sta_resp(priv, sta, pkt, true);
- }
iwl_free_pages(priv->shrd, cmd.reply_page);
- return ret;
+ if (cmd.handler_status)
+ IWL_ERR(priv, "%s - error in the CMD response %d", __func__,
+ cmd.handler_status);
+
+ return cmd.handler_status;
}
static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,