aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorRajkumar Manoharan <rmanoharan@atheros.com>2011-04-15 02:58:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-19 15:38:03 -0400
commit00bca7e2f2b58b93ce408e92d18a8c42bbe8d6e5 (patch)
tree709094fd9d9b43e6228358a775598bb2da5c7071 /drivers/net/wireless/ath
parent2290a9c35df271cc33601b69e7836fa288e2fc7d (diff)
ath9k_htc: Add debugfs support to change debug mask
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com> Acked-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c49
2 files changed, 50 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index cc5d0a4b9da2..852cdcfbcbb6 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -366,6 +366,7 @@ struct ath9k_debug {
366 struct dentry *debugfs_recv; 366 struct dentry *debugfs_recv;
367 struct dentry *debugfs_slot; 367 struct dentry *debugfs_slot;
368 struct dentry *debugfs_queue; 368 struct dentry *debugfs_queue;
369 struct dentry *debugfs_debug;
369 struct ath_tx_stats tx_stats; 370 struct ath_tx_stats tx_stats;
370 struct ath_rx_stats rx_stats; 371 struct ath_rx_stats rx_stats;
371}; 372};
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index 8d0de60e0c27..7394a1b9882a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -435,6 +435,47 @@ static const struct file_operations fops_queue = {
435 .llseek = default_llseek, 435 .llseek = default_llseek,
436}; 436};
437 437
438static ssize_t read_file_debug(struct file *file, char __user *user_buf,
439 size_t count, loff_t *ppos)
440{
441 struct ath9k_htc_priv *priv = file->private_data;
442 struct ath_common *common = ath9k_hw_common(priv->ah);
443 char buf[32];
444 unsigned int len;
445
446 len = sprintf(buf, "0x%08x\n", common->debug_mask);
447 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
448}
449
450static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
451 size_t count, loff_t *ppos)
452{
453 struct ath9k_htc_priv *priv = file->private_data;
454 struct ath_common *common = ath9k_hw_common(priv->ah);
455 unsigned long mask;
456 char buf[32];
457 ssize_t len;
458
459 len = min(count, sizeof(buf) - 1);
460 if (copy_from_user(buf, user_buf, len))
461 return -EFAULT;
462
463 buf[len] = '\0';
464 if (strict_strtoul(buf, 0, &mask))
465 return -EINVAL;
466
467 common->debug_mask = mask;
468 return count;
469}
470
471static const struct file_operations fops_debug = {
472 .read = read_file_debug,
473 .write = write_file_debug,
474 .open = ath9k_debugfs_open,
475 .owner = THIS_MODULE,
476 .llseek = default_llseek,
477};
478
438int ath9k_htc_init_debug(struct ath_hw *ah) 479int ath9k_htc_init_debug(struct ath_hw *ah)
439{ 480{
440 struct ath_common *common = ath9k_hw_common(ah); 481 struct ath_common *common = ath9k_hw_common(ah);
@@ -493,6 +534,13 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
493 if (!priv->debug.debugfs_queue) 534 if (!priv->debug.debugfs_queue)
494 goto err; 535 goto err;
495 536
537 priv->debug.debugfs_debug = debugfs_create_file("debug",
538 S_IRUSR | S_IWUSR,
539 priv->debug.debugfs_phy,
540 priv, &fops_debug);
541 if (!priv->debug.debugfs_debug)
542 goto err;
543
496 return 0; 544 return 0;
497 545
498err: 546err:
@@ -512,6 +560,7 @@ void ath9k_htc_exit_debug(struct ath_hw *ah)
512 debugfs_remove(priv->debug.debugfs_tgt_int_stats); 560 debugfs_remove(priv->debug.debugfs_tgt_int_stats);
513 debugfs_remove(priv->debug.debugfs_tgt_tx_stats); 561 debugfs_remove(priv->debug.debugfs_tgt_tx_stats);
514 debugfs_remove(priv->debug.debugfs_tgt_rx_stats); 562 debugfs_remove(priv->debug.debugfs_tgt_rx_stats);
563 debugfs_remove(priv->debug.debugfs_debug);
515 debugfs_remove(priv->debug.debugfs_phy); 564 debugfs_remove(priv->debug.debugfs_phy);
516} 565}
517 566