diff options
author | Mohammed Shafi Shajakhan <mshajakhan@atheros.com> | 2011-05-26 01:26:15 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-06-01 15:36:29 -0400 |
commit | 05c0be2f7f10404e5b3bc4105f9206096e9b8767 (patch) | |
tree | c9753e6c2720688a68ac15778345d27e3945d33e /drivers/net/wireless/ath/ath9k/debug.c | |
parent | 81168e509f06aa205b240c1804ec2b9b5add4772 (diff) |
ath9k: Add a debug entry to start/stop ANI
this helps the user to start/stop ANI dynamically.
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 202399d4fe1..7230d6578b1 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -176,6 +176,56 @@ static const struct file_operations fops_rx_chainmask = { | |||
176 | .llseek = default_llseek, | 176 | .llseek = default_llseek, |
177 | }; | 177 | }; |
178 | 178 | ||
179 | static ssize_t read_file_disable_ani(struct file *file, char __user *user_buf, | ||
180 | size_t count, loff_t *ppos) | ||
181 | { | ||
182 | struct ath_softc *sc = file->private_data; | ||
183 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
184 | char buf[32]; | ||
185 | unsigned int len; | ||
186 | |||
187 | len = sprintf(buf, "%d\n", common->disable_ani); | ||
188 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
189 | } | ||
190 | |||
191 | static ssize_t write_file_disable_ani(struct file *file, | ||
192 | const char __user *user_buf, | ||
193 | size_t count, loff_t *ppos) | ||
194 | { | ||
195 | struct ath_softc *sc = file->private_data; | ||
196 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
197 | unsigned long disable_ani; | ||
198 | char buf[32]; | ||
199 | ssize_t len; | ||
200 | |||
201 | len = min(count, sizeof(buf) - 1); | ||
202 | if (copy_from_user(buf, user_buf, len)) | ||
203 | return -EFAULT; | ||
204 | |||
205 | buf[len] = '\0'; | ||
206 | if (strict_strtoul(buf, 0, &disable_ani)) | ||
207 | return -EINVAL; | ||
208 | |||
209 | common->disable_ani = !!disable_ani; | ||
210 | |||
211 | if (disable_ani) { | ||
212 | sc->sc_flags &= ~SC_OP_ANI_RUN; | ||
213 | del_timer_sync(&common->ani.timer); | ||
214 | } else { | ||
215 | sc->sc_flags |= SC_OP_ANI_RUN; | ||
216 | ath_start_ani(common); | ||
217 | } | ||
218 | |||
219 | return count; | ||
220 | } | ||
221 | |||
222 | static const struct file_operations fops_disable_ani = { | ||
223 | .read = read_file_disable_ani, | ||
224 | .write = write_file_disable_ani, | ||
225 | .open = ath9k_debugfs_open, | ||
226 | .owner = THIS_MODULE, | ||
227 | .llseek = default_llseek, | ||
228 | }; | ||
179 | 229 | ||
180 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, | 230 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
181 | size_t count, loff_t *ppos) | 231 | size_t count, loff_t *ppos) |
@@ -1159,6 +1209,8 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1159 | sc->debug.debugfs_phy, sc, &fops_rx_chainmask); | 1209 | sc->debug.debugfs_phy, sc, &fops_rx_chainmask); |
1160 | debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, | 1210 | debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, |
1161 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); | 1211 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); |
1212 | debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR, | ||
1213 | sc->debug.debugfs_phy, sc, &fops_disable_ani); | ||
1162 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1214 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1163 | sc, &fops_regidx); | 1215 | sc, &fops_regidx); |
1164 | debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1216 | debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |