Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[cascardo/linux.git] / drivers / net / wireless / ath / ath10k / testmode.c
index 120f423..ed85f93 100644 (file)
@@ -23,6 +23,7 @@
 #include "wmi.h"
 #include "hif.h"
 #include "hw.h"
+#include "core.h"
 
 #include "testmode_i.h"
 
@@ -45,7 +46,7 @@ bool ath10k_tm_event_wmi(struct ath10k *ar, u32 cmd_id, struct sk_buff *skb)
        int ret;
 
        ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
-                  "testmode event wmi cmd_id %d skb %p skb->len %d\n",
+                  "testmode event wmi cmd_id %d skb %pK skb->len %d\n",
                   cmd_id, skb, skb->len);
 
        ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", skb->data, skb->len);
@@ -240,6 +241,18 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[])
                goto err;
        }
 
+       if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+           ar->testmode.utf_mode_fw.fw_file.codeswap_len) {
+               ret = ath10k_swap_code_seg_init(ar,
+                                               &ar->testmode.utf_mode_fw.fw_file);
+               if (ret) {
+                       ath10k_warn(ar,
+                                   "failed to init utf code swap segment: %d\n",
+                                   ret);
+                       goto err_release_utf_mode_fw;
+               }
+       }
+
        spin_lock_bh(&ar->data_lock);
        ar->testmode.utf_monitor = true;
        spin_unlock_bh(&ar->data_lock);
@@ -279,6 +292,11 @@ err_power_down:
        ath10k_hif_power_down(ar);
 
 err_release_utf_mode_fw:
+       if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+           ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+               ath10k_swap_code_seg_release(ar,
+                                            &ar->testmode.utf_mode_fw.fw_file);
+
        release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
        ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
@@ -301,6 +319,11 @@ static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar)
 
        spin_unlock_bh(&ar->data_lock);
 
+       if (ar->testmode.utf_mode_fw.fw_file.codeswap_data &&
+           ar->testmode.utf_mode_fw.fw_file.codeswap_len)
+               ath10k_swap_code_seg_release(ar,
+                                            &ar->testmode.utf_mode_fw.fw_file);
+
        release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
        ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
 
@@ -360,7 +383,7 @@ static int ath10k_tm_cmd_wmi(struct ath10k *ar, struct nlattr *tb[])
        cmd_id = nla_get_u32(tb[ATH10K_TM_ATTR_WMI_CMDID]);
 
        ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
-                  "testmode cmd wmi cmd_id %d buf %p buf_len %d\n",
+                  "testmode cmd wmi cmd_id %d buf %pK buf_len %d\n",
                   cmd_id, buf, buf_len);
 
        ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", buf, buf_len);