aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c49
1 files changed, 18 insertions, 31 deletions
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index c2d549f871f9..42ea5b1bdb12 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -60,6 +60,7 @@
60 60
61#include "base.h" 61#include "base.h"
62#include "debug.h" 62#include "debug.h"
63#include "../debug.h"
63 64
64static unsigned int ath5k_debug; 65static unsigned int ath5k_debug;
65module_param_named(debug, ath5k_debug, uint, 0); 66module_param_named(debug, ath5k_debug, uint, 0);
@@ -71,8 +72,6 @@ module_param_named(debug, ath5k_debug, uint, 0);
71#include "reg.h" 72#include "reg.h"
72#include "ani.h" 73#include "ani.h"
73 74
74static struct dentry *ath5k_global_debugfs;
75
76static int ath5k_debugfs_open(struct inode *inode, struct file *file) 75static int ath5k_debugfs_open(struct inode *inode, struct file *file)
77{ 76{
78 file->private_data = inode->i_private; 77 file->private_data = inode->i_private;
@@ -520,9 +519,10 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
520 if (filt & AR5K_RX_FILTER_PHYERR_5211) 519 if (filt & AR5K_RX_FILTER_PHYERR_5211)
521 snprintf(buf+len, sizeof(buf)-len, " PHYERR-5211"); 520 snprintf(buf+len, sizeof(buf)-len, " PHYERR-5211");
522 if (filt & AR5K_RX_FILTER_RADARERR_5211) 521 if (filt & AR5K_RX_FILTER_RADARERR_5211)
523 len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5211\n"); 522 len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5211");
524 else 523
525 len += snprintf(buf+len, sizeof(buf)-len, "\n"); 524 len += snprintf(buf+len, sizeof(buf)-len, "\nopmode: %s (%d)\n",
525 ath_opmode_to_string(sc->opmode), sc->opmode);
526 526
527 if (len > sizeof(buf)) 527 if (len > sizeof(buf))
528 len = sizeof(buf); 528 len = sizeof(buf);
@@ -715,20 +715,21 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf,
715 len += snprintf(buf+len, sizeof(buf)-len, 715 len += snprintf(buf+len, sizeof(buf)-len,
716 "beacon RSSI average:\t%d\n", 716 "beacon RSSI average:\t%d\n",
717 sc->ah->ah_beacon_rssi_avg.avg); 717 sc->ah->ah_beacon_rssi_avg.avg);
718
719#define CC_PRINT(_struct, _field) \
720 _struct._field, \
721 _struct.cycles > 0 ? \
722 _struct._field*100/_struct.cycles : 0
723
718 len += snprintf(buf+len, sizeof(buf)-len, "profcnt tx\t\t%u\t(%d%%)\n", 724 len += snprintf(buf+len, sizeof(buf)-len, "profcnt tx\t\t%u\t(%d%%)\n",
719 as->pfc_tx, 725 CC_PRINT(as->last_cc, tx_frame));
720 as->pfc_cycles > 0 ?
721 as->pfc_tx*100/as->pfc_cycles : 0);
722 len += snprintf(buf+len, sizeof(buf)-len, "profcnt rx\t\t%u\t(%d%%)\n", 726 len += snprintf(buf+len, sizeof(buf)-len, "profcnt rx\t\t%u\t(%d%%)\n",
723 as->pfc_rx, 727 CC_PRINT(as->last_cc, rx_frame));
724 as->pfc_cycles > 0 ?
725 as->pfc_rx*100/as->pfc_cycles : 0);
726 len += snprintf(buf+len, sizeof(buf)-len, "profcnt busy\t\t%u\t(%d%%)\n", 728 len += snprintf(buf+len, sizeof(buf)-len, "profcnt busy\t\t%u\t(%d%%)\n",
727 as->pfc_busy, 729 CC_PRINT(as->last_cc, rx_busy));
728 as->pfc_cycles > 0 ? 730#undef CC_PRINT
729 as->pfc_busy*100/as->pfc_cycles : 0);
730 len += snprintf(buf+len, sizeof(buf)-len, "profcnt cycles\t\t%u\n", 731 len += snprintf(buf+len, sizeof(buf)-len, "profcnt cycles\t\t%u\n",
731 as->pfc_cycles); 732 as->last_cc.cycles);
732 len += snprintf(buf+len, sizeof(buf)-len, 733 len += snprintf(buf+len, sizeof(buf)-len,
733 "listen time\t\t%d\tlast: %d\n", 734 "listen time\t\t%d\tlast: %d\n",
734 as->listen_time, as->last_listen); 735 as->listen_time, as->last_listen);
@@ -879,21 +880,13 @@ static const struct file_operations fops_queue = {
879}; 880};
880 881
881 882
882/* init */
883
884void
885ath5k_debug_init(void)
886{
887 ath5k_global_debugfs = debugfs_create_dir("ath5k", NULL);
888}
889
890void 883void
891ath5k_debug_init_device(struct ath5k_softc *sc) 884ath5k_debug_init_device(struct ath5k_softc *sc)
892{ 885{
893 sc->debug.level = ath5k_debug; 886 sc->debug.level = ath5k_debug;
894 887
895 sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy), 888 sc->debug.debugfs_phydir = debugfs_create_dir("ath5k",
896 ath5k_global_debugfs); 889 sc->hw->wiphy->debugfsdir);
897 890
898 sc->debug.debugfs_debug = debugfs_create_file("debug", 891 sc->debug.debugfs_debug = debugfs_create_file("debug",
899 S_IWUSR | S_IRUSR, 892 S_IWUSR | S_IRUSR,
@@ -934,12 +927,6 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
934} 927}
935 928
936void 929void
937ath5k_debug_finish(void)
938{
939 debugfs_remove(ath5k_global_debugfs);
940}
941
942void
943ath5k_debug_finish_device(struct ath5k_softc *sc) 930ath5k_debug_finish_device(struct ath5k_softc *sc)
944{ 931{
945 debugfs_remove(sc->debug.debugfs_debug); 932 debugfs_remove(sc->debug.debugfs_debug);