tree-wide: replace config_enabled() with IS_ENABLED()
[cascardo/linux.git] / drivers / net / wireless / ath / ath10k / debug.c
index e251155..8f0fd41 100644 (file)
@@ -139,11 +139,11 @@ void ath10k_debug_print_hwfw_info(struct ath10k *ar)
                    ar->id.subsystem_vendor, ar->id.subsystem_device);
 
        ath10k_info(ar, "kconfig debug %d debugfs %d tracing %d dfs %d testmode %d\n",
-                   config_enabled(CONFIG_ATH10K_DEBUG),
-                   config_enabled(CONFIG_ATH10K_DEBUGFS),
-                   config_enabled(CONFIG_ATH10K_TRACING),
-                   config_enabled(CONFIG_ATH10K_DFS_CERTIFIED),
-                   config_enabled(CONFIG_NL80211_TESTMODE));
+                   IS_ENABLED(CONFIG_ATH10K_DEBUG),
+                   IS_ENABLED(CONFIG_ATH10K_DEBUGFS),
+                   IS_ENABLED(CONFIG_ATH10K_TRACING),
+                   IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED),
+                   IS_ENABLED(CONFIG_NL80211_TESTMODE));
 
        firmware = ar->normal_mode_fw.fw_file.firmware;
        if (firmware)
@@ -313,13 +313,25 @@ static void ath10k_fw_stats_peers_free(struct list_head *head)
        }
 }
 
+static void ath10k_fw_extd_stats_peers_free(struct list_head *head)
+{
+       struct ath10k_fw_extd_stats_peer *i, *tmp;
+
+       list_for_each_entry_safe(i, tmp, head, list) {
+               list_del(&i->list);
+               kfree(i);
+       }
+}
+
 static void ath10k_debug_fw_stats_reset(struct ath10k *ar)
 {
        spin_lock_bh(&ar->data_lock);
        ar->debug.fw_stats_done = false;
+       ar->debug.fw_stats.extended = false;
        ath10k_fw_stats_pdevs_free(&ar->debug.fw_stats.pdevs);
        ath10k_fw_stats_vdevs_free(&ar->debug.fw_stats.vdevs);
        ath10k_fw_stats_peers_free(&ar->debug.fw_stats.peers);
+       ath10k_fw_extd_stats_peers_free(&ar->debug.fw_stats.peers_extd);
        spin_unlock_bh(&ar->data_lock);
 }
 
@@ -334,6 +346,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
        INIT_LIST_HEAD(&stats.pdevs);
        INIT_LIST_HEAD(&stats.vdevs);
        INIT_LIST_HEAD(&stats.peers);
+       INIT_LIST_HEAD(&stats.peers_extd);
 
        spin_lock_bh(&ar->data_lock);
        ret = ath10k_wmi_pull_fw_stats(ar, skb, &stats);
@@ -354,7 +367,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
         *     delivered which is treated as end-of-data and is itself discarded
         */
        if (ath10k_peer_stats_enabled(ar))
-               ath10k_sta_update_rx_duration(ar, &stats.peers);
+               ath10k_sta_update_rx_duration(ar, &stats);
 
        if (ar->debug.fw_stats_done) {
                if (!ath10k_peer_stats_enabled(ar))
@@ -396,6 +409,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb)
 
                list_splice_tail_init(&stats.peers, &ar->debug.fw_stats.peers);
                list_splice_tail_init(&stats.vdevs, &ar->debug.fw_stats.vdevs);
+               list_splice_tail_init(&stats.peers_extd,
+                                     &ar->debug.fw_stats.peers_extd);
        }
 
        complete(&ar->debug.fw_stats_complete);
@@ -407,6 +422,7 @@ free:
        ath10k_fw_stats_pdevs_free(&stats.pdevs);
        ath10k_fw_stats_vdevs_free(&stats.vdevs);
        ath10k_fw_stats_peers_free(&stats.peers);
+       ath10k_fw_extd_stats_peers_free(&stats.peers_extd);
 
        spin_unlock_bh(&ar->data_lock);
 }
@@ -609,25 +625,23 @@ static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
        char buf[32];
        int ret;
 
-       mutex_lock(&ar->conf_mutex);
-
        simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
 
        /* make sure that buf is null terminated */
        buf[sizeof(buf) - 1] = 0;
 
+       /* drop the possible '\n' from the end */
+       if (buf[count - 1] == '\n')
+               buf[count - 1] = 0;
+
+       mutex_lock(&ar->conf_mutex);
+
        if (ar->state != ATH10K_STATE_ON &&
            ar->state != ATH10K_STATE_RESTARTED) {
                ret = -ENETDOWN;
                goto exit;
        }
 
-       /* drop the possible '\n' from the end */
-       if (buf[count - 1] == '\n') {
-               buf[count - 1] = 0;
-               count--;
-       }
-
        if (!strcmp(buf, "soft")) {
                ath10k_info(ar, "simulating soft firmware crash\n");
                ret = ath10k_wmi_force_fw_hang(ar, WMI_FORCE_FW_HANG_ASSERT, 0);
@@ -2127,6 +2141,7 @@ static ssize_t ath10k_write_btcoex(struct file *file,
        size_t buf_size;
        int ret;
        bool val;
+       u32 pdev_param;
 
        buf_size = min(count, (sizeof(buf) - 1));
        if (copy_from_user(buf, ubuf, buf_size))
@@ -2150,14 +2165,25 @@ static ssize_t ath10k_write_btcoex(struct file *file,
                goto exit;
        }
 
+       pdev_param = ar->wmi.pdev_param->enable_btcoex;
+       if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
+                    ar->running_fw->fw_file.fw_features)) {
+               ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
+               if (ret) {
+                       ath10k_warn(ar, "failed to enable btcoex: %d\n", ret);
+                       ret = count;
+                       goto exit;
+               }
+       } else {
+               ath10k_info(ar, "restarting firmware due to btcoex change");
+               queue_work(ar->workqueue, &ar->restart_work);
+       }
+
        if (val)
                set_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
        else
                clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
 
-       ath10k_info(ar, "restarting firmware due to btcoex change");
-
-       queue_work(ar->workqueue, &ar->restart_work);
        ret = count;
 
 exit:
@@ -2320,6 +2346,7 @@ int ath10k_debug_create(struct ath10k *ar)
        INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs);
        INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs);
        INIT_LIST_HEAD(&ar->debug.fw_stats.peers);
+       INIT_LIST_HEAD(&ar->debug.fw_stats.peers_extd);
 
        return 0;
 }
@@ -2397,7 +2424,7 @@ int ath10k_debug_register(struct ath10k *ar)
        debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR,
                            ar->debug.debugfs_phy, ar, &fops_nf_cal_period);
 
-       if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) {
+       if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) {
                debugfs_create_file("dfs_simulate_radar", S_IWUSR,
                                    ar->debug.debugfs_phy, ar,
                                    &fops_simulate_radar);