aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/debug.c
diff options
context:
space:
mode:
authorMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>2016-02-23 12:58:36 +0530
committerKalle Valo <kvalo@qca.qualcomm.com>2016-03-03 19:27:17 +0200
commitc28e6f06ff401ce8f37d58ff6d8123664cd65a51 (patch)
tree26191125a430dffef0418e6421d198e0a169a4a3 /drivers/net/wireless/ath/ath10k/debug.c
parentath10k: reduce number of peers to support peer stats feature (diff)
downloadlinux-dev-c28e6f06ff401ce8f37d58ff6d8123664cd65a51.tar.xz
linux-dev-c28e6f06ff401ce8f37d58ff6d8123664cd65a51.zip
ath10k: fix sanity check on enabling btcoex via debugfs
First check for the device state before enabling / disabling btcoex, also return a proper error value. Enabling / disabling btcoex ideally does a f/w + ath10k_core_restart so the checks that are applicable for 'simulate_fw_crash' shall be applicable for this as well Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index a633152787e0..076d29b53ddf 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2114,6 +2114,7 @@ static ssize_t ath10k_write_btcoex(struct file *file,
struct ath10k *ar = file->private_data;
char buf[32];
size_t buf_size;
+ int ret = 0;
bool val;
buf_size = min(count, (sizeof(buf) - 1));
@@ -2127,6 +2128,12 @@ static ssize_t ath10k_write_btcoex(struct file *file,
mutex_lock(&ar->conf_mutex);
+ if (ar->state != ATH10K_STATE_ON &&
+ ar->state != ATH10K_STATE_RESTARTED) {
+ ret = -ENETDOWN;
+ goto exit;
+ }
+
if (!(test_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags) ^ val))
goto exit;
@@ -2135,17 +2142,15 @@ static ssize_t ath10k_write_btcoex(struct file *file,
else
clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags);
- if (ar->state != ATH10K_STATE_ON)
- goto exit;
-
ath10k_info(ar, "restarting firmware due to btcoex change");
queue_work(ar->workqueue, &ar->restart_work);
+ ret = count;
exit:
mutex_unlock(&ar->conf_mutex);
- return count;
+ return ret;
}
static ssize_t ath10k_read_btcoex(struct file *file, char __user *ubuf,