diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/debug.c')
| -rw-r--r-- | drivers/net/wireless/ath/ath10k/debug.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 42b2e49b2836..d2281e5c2ffe 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c | |||
| @@ -1318,10 +1318,10 @@ static ssize_t ath10k_read_fw_dbglog(struct file *file, | |||
| 1318 | { | 1318 | { |
| 1319 | struct ath10k *ar = file->private_data; | 1319 | struct ath10k *ar = file->private_data; |
| 1320 | unsigned int len; | 1320 | unsigned int len; |
| 1321 | char buf[32]; | 1321 | char buf[64]; |
| 1322 | 1322 | ||
| 1323 | len = scnprintf(buf, sizeof(buf), "0x%08x\n", | 1323 | len = scnprintf(buf, sizeof(buf), "0x%08x %u\n", |
| 1324 | ar->debug.fw_dbglog_mask); | 1324 | ar->debug.fw_dbglog_mask, ar->debug.fw_dbglog_level); |
| 1325 | 1325 | ||
| 1326 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 1326 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 1327 | } | 1327 | } |
| @@ -1331,19 +1331,32 @@ static ssize_t ath10k_write_fw_dbglog(struct file *file, | |||
| 1331 | size_t count, loff_t *ppos) | 1331 | size_t count, loff_t *ppos) |
| 1332 | { | 1332 | { |
| 1333 | struct ath10k *ar = file->private_data; | 1333 | struct ath10k *ar = file->private_data; |
| 1334 | unsigned long mask; | ||
| 1335 | int ret; | 1334 | int ret; |
| 1335 | char buf[64]; | ||
| 1336 | unsigned int log_level, mask; | ||
| 1336 | 1337 | ||
| 1337 | ret = kstrtoul_from_user(user_buf, count, 0, &mask); | 1338 | simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count); |
| 1338 | if (ret) | 1339 | |
| 1339 | return ret; | 1340 | /* make sure that buf is null terminated */ |
| 1341 | buf[sizeof(buf) - 1] = 0; | ||
| 1342 | |||
| 1343 | ret = sscanf(buf, "%x %u", &mask, &log_level); | ||
| 1344 | |||
| 1345 | if (!ret) | ||
| 1346 | return -EINVAL; | ||
| 1347 | |||
| 1348 | if (ret == 1) | ||
| 1349 | /* default if user did not specify */ | ||
| 1350 | log_level = ATH10K_DBGLOG_LEVEL_WARN; | ||
| 1340 | 1351 | ||
| 1341 | mutex_lock(&ar->conf_mutex); | 1352 | mutex_lock(&ar->conf_mutex); |
| 1342 | 1353 | ||
| 1343 | ar->debug.fw_dbglog_mask = mask; | 1354 | ar->debug.fw_dbglog_mask = mask; |
| 1355 | ar->debug.fw_dbglog_level = log_level; | ||
| 1344 | 1356 | ||
| 1345 | if (ar->state == ATH10K_STATE_ON) { | 1357 | if (ar->state == ATH10K_STATE_ON) { |
| 1346 | ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask); | 1358 | ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, |
| 1359 | ar->debug.fw_dbglog_level); | ||
| 1347 | if (ret) { | 1360 | if (ret) { |
| 1348 | ath10k_warn(ar, "dbglog cfg failed from debugfs: %d\n", | 1361 | ath10k_warn(ar, "dbglog cfg failed from debugfs: %d\n", |
| 1349 | ret); | 1362 | ret); |
| @@ -1685,7 +1698,8 @@ int ath10k_debug_start(struct ath10k *ar) | |||
| 1685 | ret); | 1698 | ret); |
| 1686 | 1699 | ||
| 1687 | if (ar->debug.fw_dbglog_mask) { | 1700 | if (ar->debug.fw_dbglog_mask) { |
| 1688 | ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask); | 1701 | ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask, |
| 1702 | ATH10K_DBGLOG_LEVEL_WARN); | ||
| 1689 | if (ret) | 1703 | if (ret) |
| 1690 | /* not serious */ | 1704 | /* not serious */ |
| 1691 | ath10k_warn(ar, "failed to enable dbglog during start: %d", | 1705 | ath10k_warn(ar, "failed to enable dbglog during start: %d", |
