]> err.no Git - linux-2.6/commitdiff
iwlwifi: move add sta handler to iwl-sta.c
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 29 May 2008 08:35:03 +0000 (16:35 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 3 Jun 2008 19:00:23 +0000 (15:00 -0400)
This patch moves add_sta hander to iwl-sta.c.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl4965-base.c

index 11ec408f99c52c673d16fc9671982f4c495ab0c8..ed07566f22ee7a31eb66197cdba4b1ac8c1f84b7 100644 (file)
@@ -74,6 +74,39 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
 }
 EXPORT_SYMBOL(iwl_find_station);
 
+static int iwl_add_sta_callback(struct iwl_priv *priv,
+                                  struct iwl_cmd *cmd, struct sk_buff *skb)
+{
+       struct iwl_rx_packet *res = NULL;
+
+       if (!skb) {
+               IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
+               return 1;
+       }
+
+       res = (struct iwl_rx_packet *)skb->data;
+       if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
+               IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
+                         res->hdr.flags);
+               return 1;
+       }
+
+       switch (res->u.add_sta.status) {
+       case ADD_STA_SUCCESS_MSK:
+               /* FIXME: implement iwl_sta_ucode_activate(priv, addr); */
+               /* fail through */
+       default:
+               IWL_DEBUG_HC("Received REPLY_ADD_STA:(0x%08X)\n",
+                            res->u.add_sta.status);
+               break;
+       }
+
+       /* We didn't cache the SKB; let the caller free it */
+       return 1;
+}
+
+
+
 int iwl_send_add_sta(struct iwl_priv *priv,
                     struct iwl_addsta_cmd *sta, u8 flags)
 {
@@ -86,7 +119,9 @@ int iwl_send_add_sta(struct iwl_priv *priv,
                .data = data,
        };
 
-       if (!(flags & CMD_ASYNC))
+       if (flags & CMD_ASYNC)
+               cmd.meta.u.callback = iwl_add_sta_callback;
+       else
                cmd.meta.flags |= CMD_WANT_SKB;
 
        cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
index 185d667fc71bfcdb985e90d2cc052b4d3a4fa07e..f3815b79b6af76c3730c955ba7ca771e843aa018 100644 (file)
@@ -1921,15 +1921,6 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
                IWL_WARNING("uCode did not respond OK.\n");
 }
 
-static void iwl4965_rx_reply_add_sta(struct iwl_priv *priv,
-                                    struct iwl_rx_mem_buffer *rxb)
-{
-       struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
-
-       IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
-       return;
-}
-
 static void iwl4965_rx_reply_error(struct iwl_priv *priv,
                                   struct iwl_rx_mem_buffer *rxb)
 {
@@ -2238,7 +2229,6 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
 static void iwl4965_setup_rx_handlers(struct iwl_priv *priv)
 {
        priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive;
-       priv->rx_handlers[REPLY_ADD_STA] = iwl4965_rx_reply_add_sta;
        priv->rx_handlers[REPLY_ERROR] = iwl4965_rx_reply_error;
        priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl4965_rx_csa;
        priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =