diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-05-11 11:23:01 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-12 16:39:06 -0400 |
commit | 1534069491c67619bfaeb25368a1249b669503c3 (patch) | |
tree | 7b00c227ed78b3153da1a5ad1369288fa9836a75 /drivers/net | |
parent | c8a72c00c6a58186c35901c5fb15584ebc2a081d (diff) |
ath9k: add debugfs files for reading/writing the rx and tx chainmask
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 59252ce24d7f..7a2fe09d4a99 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -77,6 +77,90 @@ static const struct file_operations fops_debug = { | |||
77 | 77 | ||
78 | #define DMA_BUF_LEN 1024 | 78 | #define DMA_BUF_LEN 1024 |
79 | 79 | ||
80 | static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, | ||
81 | size_t count, loff_t *ppos) | ||
82 | { | ||
83 | struct ath_softc *sc = file->private_data; | ||
84 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
85 | char buf[32]; | ||
86 | unsigned int len; | ||
87 | |||
88 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask); | ||
89 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
90 | } | ||
91 | |||
92 | static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf, | ||
93 | size_t count, loff_t *ppos) | ||
94 | { | ||
95 | struct ath_softc *sc = file->private_data; | ||
96 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
97 | unsigned long mask; | ||
98 | char buf[32]; | ||
99 | ssize_t len; | ||
100 | |||
101 | len = min(count, sizeof(buf) - 1); | ||
102 | if (copy_from_user(buf, user_buf, len)) | ||
103 | return -EINVAL; | ||
104 | |||
105 | buf[len] = '\0'; | ||
106 | if (strict_strtoul(buf, 0, &mask)) | ||
107 | return -EINVAL; | ||
108 | |||
109 | common->tx_chainmask = mask; | ||
110 | sc->sc_ah->caps.tx_chainmask = mask; | ||
111 | return count; | ||
112 | } | ||
113 | |||
114 | static const struct file_operations fops_tx_chainmask = { | ||
115 | .read = read_file_tx_chainmask, | ||
116 | .write = write_file_tx_chainmask, | ||
117 | .open = ath9k_debugfs_open, | ||
118 | .owner = THIS_MODULE | ||
119 | }; | ||
120 | |||
121 | |||
122 | static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf, | ||
123 | size_t count, loff_t *ppos) | ||
124 | { | ||
125 | struct ath_softc *sc = file->private_data; | ||
126 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
127 | char buf[32]; | ||
128 | unsigned int len; | ||
129 | |||
130 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask); | ||
131 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
132 | } | ||
133 | |||
134 | static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf, | ||
135 | size_t count, loff_t *ppos) | ||
136 | { | ||
137 | struct ath_softc *sc = file->private_data; | ||
138 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
139 | unsigned long mask; | ||
140 | char buf[32]; | ||
141 | ssize_t len; | ||
142 | |||
143 | len = min(count, sizeof(buf) - 1); | ||
144 | if (copy_from_user(buf, user_buf, len)) | ||
145 | return -EINVAL; | ||
146 | |||
147 | buf[len] = '\0'; | ||
148 | if (strict_strtoul(buf, 0, &mask)) | ||
149 | return -EINVAL; | ||
150 | |||
151 | common->rx_chainmask = mask; | ||
152 | sc->sc_ah->caps.rx_chainmask = mask; | ||
153 | return count; | ||
154 | } | ||
155 | |||
156 | static const struct file_operations fops_rx_chainmask = { | ||
157 | .read = read_file_rx_chainmask, | ||
158 | .write = write_file_rx_chainmask, | ||
159 | .open = ath9k_debugfs_open, | ||
160 | .owner = THIS_MODULE | ||
161 | }; | ||
162 | |||
163 | |||
80 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, | 164 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
81 | size_t count, loff_t *ppos) | 165 | size_t count, loff_t *ppos) |
82 | { | 166 | { |
@@ -753,6 +837,14 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
753 | sc, &fops_recv)) | 837 | sc, &fops_recv)) |
754 | goto err; | 838 | goto err; |
755 | 839 | ||
840 | if (!debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, | ||
841 | sc->debug.debugfs_phy, sc, &fops_rx_chainmask)) | ||
842 | goto err; | ||
843 | |||
844 | if (!debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, | ||
845 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask)) | ||
846 | goto err; | ||
847 | |||
756 | return 0; | 848 | return 0; |
757 | err: | 849 | err: |
758 | ath9k_exit_debug(ah); | 850 | ath9k_exit_debug(ah); |