diff options
author | Alina Friedrichsen <x-alina@gmx.net> | 2009-01-24 01:09:59 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:01:46 -0500 |
commit | 3b5d665b51cda73ef1a774b515afd879a38e3674 (patch) | |
tree | 68d71f6ac09f638b65ca1e256a17dfdb6c5b12b4 /drivers/net/wireless/ath9k | |
parent | 3978e5bce63484789891c67413372da3915bcbd6 (diff) |
mac80211: Generic TSF debugging
This patch enables low-level driver independent debugging of the TSF and remove the driver specific things of ath5k and ath9k from the debugfs.
Signed-off-by: Alina Friedrichsen <x-alina@gmx.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k')
-rw-r--r-- | drivers/net/wireless/ath9k/core.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/debug.c | 48 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 9 |
3 files changed, 9 insertions, 49 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index acbd8881ef83..29251f8dabb0 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -141,7 +141,6 @@ struct ath9k_debug { | |||
141 | struct dentry *debugfs_phy; | 141 | struct dentry *debugfs_phy; |
142 | struct dentry *debugfs_dma; | 142 | struct dentry *debugfs_dma; |
143 | struct dentry *debugfs_interrupt; | 143 | struct dentry *debugfs_interrupt; |
144 | struct dentry *debugfs_tsf; | ||
145 | struct ath_stats stats; | 144 | struct ath_stats stats; |
146 | }; | 145 | }; |
147 | 146 | ||
diff --git a/drivers/net/wireless/ath9k/debug.c b/drivers/net/wireless/ath9k/debug.c index 05e1f82cc7a1..1680164b4adb 100644 --- a/drivers/net/wireless/ath9k/debug.c +++ b/drivers/net/wireless/ath9k/debug.c | |||
@@ -223,48 +223,6 @@ static const struct file_operations fops_interrupt = { | |||
223 | }; | 223 | }; |
224 | 224 | ||
225 | 225 | ||
226 | static ssize_t read_file_tsf(struct file *file, char __user *user_buf, | ||
227 | size_t count, loff_t *ppos) | ||
228 | { | ||
229 | struct ath_softc *sc = file->private_data; | ||
230 | char buf[100]; | ||
231 | snprintf(buf, sizeof(buf), "0x%016llx\n", | ||
232 | (unsigned long long)ath9k_hw_gettsf64(sc->sc_ah)); | ||
233 | return simple_read_from_buffer(user_buf, count, ppos, buf, 19); | ||
234 | } | ||
235 | |||
236 | static ssize_t write_file_tsf(struct file *file, | ||
237 | const char __user *user_buf, | ||
238 | size_t count, loff_t *ppos) | ||
239 | { | ||
240 | struct ath_softc *sc = file->private_data; | ||
241 | char buf[21]; | ||
242 | unsigned long long tsf; | ||
243 | |||
244 | if (copy_from_user(buf, user_buf, min(count, sizeof(buf) - 1))) | ||
245 | return -EFAULT; | ||
246 | buf[sizeof(buf) - 1] = '\0'; | ||
247 | |||
248 | if (strncmp(buf, "reset", 5) == 0) { | ||
249 | ath9k_hw_reset_tsf(sc->sc_ah); | ||
250 | printk(KERN_INFO "debugfs reset TSF\n"); | ||
251 | } else { | ||
252 | tsf = simple_strtoul(buf, NULL, 0); | ||
253 | ath9k_hw_settsf64(sc->sc_ah, tsf); | ||
254 | printk(KERN_INFO "debugfs set TSF to %#018llx\n", tsf); | ||
255 | } | ||
256 | |||
257 | return count; | ||
258 | } | ||
259 | |||
260 | static const struct file_operations fops_tsf = { | ||
261 | .read = read_file_tsf, | ||
262 | .write = write_file_tsf, | ||
263 | .open = ath9k_debugfs_open, | ||
264 | .owner = THIS_MODULE | ||
265 | }; | ||
266 | |||
267 | |||
268 | int ath9k_init_debug(struct ath_softc *sc) | 226 | int ath9k_init_debug(struct ath_softc *sc) |
269 | { | 227 | { |
270 | sc->sc_debug.debug_mask = ath9k_debug; | 228 | sc->sc_debug.debug_mask = ath9k_debug; |
@@ -290,11 +248,6 @@ int ath9k_init_debug(struct ath_softc *sc) | |||
290 | if (!sc->sc_debug.debugfs_interrupt) | 248 | if (!sc->sc_debug.debugfs_interrupt) |
291 | goto err; | 249 | goto err; |
292 | 250 | ||
293 | sc->sc_debug.debugfs_tsf = debugfs_create_file("tsf", S_IRUGO, | ||
294 | sc->sc_debug.debugfs_phy, sc, &fops_tsf); | ||
295 | if (!sc->sc_debug.debugfs_tsf) | ||
296 | goto err; | ||
297 | |||
298 | return 0; | 251 | return 0; |
299 | err: | 252 | err: |
300 | ath9k_exit_debug(sc); | 253 | ath9k_exit_debug(sc); |
@@ -303,7 +256,6 @@ err: | |||
303 | 256 | ||
304 | void ath9k_exit_debug(struct ath_softc *sc) | 257 | void ath9k_exit_debug(struct ath_softc *sc) |
305 | { | 258 | { |
306 | debugfs_remove(sc->sc_debug.debugfs_tsf); | ||
307 | debugfs_remove(sc->sc_debug.debugfs_interrupt); | 259 | debugfs_remove(sc->sc_debug.debugfs_interrupt); |
308 | debugfs_remove(sc->sc_debug.debugfs_dma); | 260 | debugfs_remove(sc->sc_debug.debugfs_dma); |
309 | debugfs_remove(sc->sc_debug.debugfs_phy); | 261 | debugfs_remove(sc->sc_debug.debugfs_phy); |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 15a7f90bc84b..90e687b5a8b7 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -2451,6 +2451,14 @@ static u64 ath9k_get_tsf(struct ieee80211_hw *hw) | |||
2451 | return tsf; | 2451 | return tsf; |
2452 | } | 2452 | } |
2453 | 2453 | ||
2454 | static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) | ||
2455 | { | ||
2456 | struct ath_softc *sc = hw->priv; | ||
2457 | struct ath_hal *ah = sc->sc_ah; | ||
2458 | |||
2459 | ath9k_hw_settsf64(ah, tsf); | ||
2460 | } | ||
2461 | |||
2454 | static void ath9k_reset_tsf(struct ieee80211_hw *hw) | 2462 | static void ath9k_reset_tsf(struct ieee80211_hw *hw) |
2455 | { | 2463 | { |
2456 | struct ath_softc *sc = hw->priv; | 2464 | struct ath_softc *sc = hw->priv; |
@@ -2514,6 +2522,7 @@ struct ieee80211_ops ath9k_ops = { | |||
2514 | .bss_info_changed = ath9k_bss_info_changed, | 2522 | .bss_info_changed = ath9k_bss_info_changed, |
2515 | .set_key = ath9k_set_key, | 2523 | .set_key = ath9k_set_key, |
2516 | .get_tsf = ath9k_get_tsf, | 2524 | .get_tsf = ath9k_get_tsf, |
2525 | .set_tsf = ath9k_set_tsf, | ||
2517 | .reset_tsf = ath9k_reset_tsf, | 2526 | .reset_tsf = ath9k_reset_tsf, |
2518 | .ampdu_action = ath9k_ampdu_action, | 2527 | .ampdu_action = ath9k_ampdu_action, |
2519 | }; | 2528 | }; |