aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajkumar Manoharan <rmanoharan@atheros.com>2011-04-15 06:12:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-19 15:38:03 -0400
commite5facc75fa9104f074c4610437a9c717c9e5ecde (patch)
treed4fd9241be72b54ba6464cb66e10f2b8e4dea4c4
parent00bca7e2f2b58b93ce408e92d18a8c42bbe8d6e5 (diff)
ath9k_htc: Cleanup HTC debugfs
Move the ath9k_htc debugfs under ieee80211 to be inline with ath9k driver and it also helps to simplify debug code. 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>
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h14
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c113
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c37
3 files changed, 27 insertions, 137 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 852cdcfbcbb6..48a885575085 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -359,14 +359,6 @@ struct ath_rx_stats {
359 359
360struct ath9k_debug { 360struct ath9k_debug {
361 struct dentry *debugfs_phy; 361 struct dentry *debugfs_phy;
362 struct dentry *debugfs_tgt_int_stats;
363 struct dentry *debugfs_tgt_tx_stats;
364 struct dentry *debugfs_tgt_rx_stats;
365 struct dentry *debugfs_xmit;
366 struct dentry *debugfs_recv;
367 struct dentry *debugfs_slot;
368 struct dentry *debugfs_queue;
369 struct dentry *debugfs_debug;
370 struct ath_tx_stats tx_stats; 362 struct ath_tx_stats tx_stats;
371 struct ath_rx_stats rx_stats; 363 struct ath_rx_stats rx_stats;
372}; 364};
@@ -613,15 +605,9 @@ void ath9k_htc_suspend(struct htc_target *htc_handle);
613int ath9k_htc_resume(struct htc_target *htc_handle); 605int ath9k_htc_resume(struct htc_target *htc_handle);
614#endif 606#endif
615#ifdef CONFIG_ATH9K_HTC_DEBUGFS 607#ifdef CONFIG_ATH9K_HTC_DEBUGFS
616int ath9k_htc_debug_create_root(void);
617void ath9k_htc_debug_remove_root(void);
618int ath9k_htc_init_debug(struct ath_hw *ah); 608int ath9k_htc_init_debug(struct ath_hw *ah);
619void ath9k_htc_exit_debug(struct ath_hw *ah);
620#else 609#else
621static inline int ath9k_htc_debug_create_root(void) { return 0; };
622static inline void ath9k_htc_debug_remove_root(void) {};
623static inline int ath9k_htc_init_debug(struct ath_hw *ah) { return 0; }; 610static inline int ath9k_htc_init_debug(struct ath_hw *ah) { return 0; };
624static inline void ath9k_htc_exit_debug(struct ath_hw *ah) {};
625#endif /* CONFIG_ATH9K_HTC_DEBUGFS */ 611#endif /* CONFIG_ATH9K_HTC_DEBUGFS */
626 612
627#endif /* HTC_H */ 613#endif /* HTC_H */
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index 7394a1b9882a..eca777497fe5 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -16,8 +16,6 @@
16 16
17#include "htc.h" 17#include "htc.h"
18 18
19static struct dentry *ath9k_debugfs_root;
20
21static int ath9k_debugfs_open(struct inode *inode, struct file *file) 19static int ath9k_debugfs_open(struct inode *inode, struct file *file)
22{ 20{
23 file->private_data = inode->i_private; 21 file->private_data = inode->i_private;
@@ -481,100 +479,27 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
481 struct ath_common *common = ath9k_hw_common(ah); 479 struct ath_common *common = ath9k_hw_common(ah);
482 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; 480 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
483 481
484 if (!ath9k_debugfs_root) 482 priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
485 return -ENOENT; 483 priv->hw->wiphy->debugfsdir);
486
487 priv->debug.debugfs_phy = debugfs_create_dir(wiphy_name(priv->hw->wiphy),
488 ath9k_debugfs_root);
489 if (!priv->debug.debugfs_phy) 484 if (!priv->debug.debugfs_phy)
490 goto err; 485 return -ENOMEM;
491
492 priv->debug.debugfs_tgt_int_stats = debugfs_create_file("tgt_int_stats",
493 S_IRUSR,
494 priv->debug.debugfs_phy,
495 priv, &fops_tgt_int_stats);
496 if (!priv->debug.debugfs_tgt_int_stats)
497 goto err;
498
499 priv->debug.debugfs_tgt_tx_stats = debugfs_create_file("tgt_tx_stats",
500 S_IRUSR,
501 priv->debug.debugfs_phy,
502 priv, &fops_tgt_tx_stats);
503 if (!priv->debug.debugfs_tgt_tx_stats)
504 goto err;
505
506 priv->debug.debugfs_tgt_rx_stats = debugfs_create_file("tgt_rx_stats",
507 S_IRUSR,
508 priv->debug.debugfs_phy,
509 priv, &fops_tgt_rx_stats);
510 if (!priv->debug.debugfs_tgt_rx_stats)
511 goto err;
512
513 priv->debug.debugfs_xmit = debugfs_create_file("xmit", S_IRUSR,
514 priv->debug.debugfs_phy,
515 priv, &fops_xmit);
516 if (!priv->debug.debugfs_xmit)
517 goto err;
518
519 priv->debug.debugfs_recv = debugfs_create_file("recv", S_IRUSR,
520 priv->debug.debugfs_phy,
521 priv, &fops_recv);
522 if (!priv->debug.debugfs_recv)
523 goto err;
524
525 priv->debug.debugfs_slot = debugfs_create_file("slot", S_IRUSR,
526 priv->debug.debugfs_phy,
527 priv, &fops_slot);
528 if (!priv->debug.debugfs_slot)
529 goto err;
530
531 priv->debug.debugfs_queue = debugfs_create_file("queue", S_IRUSR,
532 priv->debug.debugfs_phy,
533 priv, &fops_queue);
534 if (!priv->debug.debugfs_queue)
535 goto err;
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
544 return 0;
545
546err:
547 ath9k_htc_exit_debug(ah);
548 return -ENOMEM;
549}
550
551void ath9k_htc_exit_debug(struct ath_hw *ah)
552{
553 struct ath_common *common = ath9k_hw_common(ah);
554 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
555
556 debugfs_remove(priv->debug.debugfs_queue);
557 debugfs_remove(priv->debug.debugfs_slot);
558 debugfs_remove(priv->debug.debugfs_recv);
559 debugfs_remove(priv->debug.debugfs_xmit);
560 debugfs_remove(priv->debug.debugfs_tgt_int_stats);
561 debugfs_remove(priv->debug.debugfs_tgt_tx_stats);
562 debugfs_remove(priv->debug.debugfs_tgt_rx_stats);
563 debugfs_remove(priv->debug.debugfs_debug);
564 debugfs_remove(priv->debug.debugfs_phy);
565}
566 486
567int ath9k_htc_debug_create_root(void) 487 debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy,
568{ 488 priv, &fops_tgt_int_stats);
569 ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); 489 debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy,
570 if (!ath9k_debugfs_root) 490 priv, &fops_tgt_tx_stats);
571 return -ENOENT; 491 debugfs_create_file("tgt_rx_stats", S_IRUSR, priv->debug.debugfs_phy,
492 priv, &fops_tgt_rx_stats);
493 debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy,
494 priv, &fops_xmit);
495 debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy,
496 priv, &fops_recv);
497 debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy,
498 priv, &fops_slot);
499 debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy,
500 priv, &fops_queue);
501 debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy,
502 priv, &fops_debug);
572 503
573 return 0; 504 return 0;
574} 505}
575
576void ath9k_htc_debug_remove_root(void)
577{
578 debugfs_remove(ath9k_debugfs_root);
579 ath9k_debugfs_root = NULL;
580}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 22736eb901cf..06e043bffaf4 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -140,7 +140,6 @@ static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv)
140 140
141static void ath9k_deinit_priv(struct ath9k_htc_priv *priv) 141static void ath9k_deinit_priv(struct ath9k_htc_priv *priv)
142{ 142{
143 ath9k_htc_exit_debug(priv->ah);
144 ath9k_hw_deinit(priv->ah); 143 ath9k_hw_deinit(priv->ah);
145 kfree(priv->ah); 144 kfree(priv->ah);
146 priv->ah = NULL; 145 priv->ah = NULL;
@@ -700,12 +699,6 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
700 goto err_hw; 699 goto err_hw;
701 } 700 }
702 701
703 ret = ath9k_htc_init_debug(ah);
704 if (ret) {
705 ath_err(common, "Unable to create debugfs files\n");
706 goto err_debug;
707 }
708
709 ret = ath9k_init_queues(priv); 702 ret = ath9k_init_queues(priv);
710 if (ret) 703 if (ret)
711 goto err_queues; 704 goto err_queues;
@@ -725,8 +718,6 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
725 return 0; 718 return 0;
726 719
727err_queues: 720err_queues:
728 ath9k_htc_exit_debug(ah);
729err_debug:
730 ath9k_hw_deinit(ah); 721 ath9k_hw_deinit(ah);
731err_hw: 722err_hw:
732 723
@@ -867,6 +858,12 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv,
867 goto err_world; 858 goto err_world;
868 } 859 }
869 860
861 error = ath9k_htc_init_debug(priv->ah);
862 if (error) {
863 ath_err(common, "Unable to create debugfs files\n");
864 goto err_world;
865 }
866
870 ath_dbg(common, ATH_DBG_CONFIG, 867 ath_dbg(common, ATH_DBG_CONFIG,
871 "WMI:%d, BCN:%d, CAB:%d, UAPSD:%d, MGMT:%d, " 868 "WMI:%d, BCN:%d, CAB:%d, UAPSD:%d, MGMT:%d, "
872 "BE:%d, BK:%d, VI:%d, VO:%d\n", 869 "BE:%d, BK:%d, VI:%d, VO:%d\n",
@@ -987,38 +984,20 @@ int ath9k_htc_resume(struct htc_target *htc_handle)
987 984
988static int __init ath9k_htc_init(void) 985static int __init ath9k_htc_init(void)
989{ 986{
990 int error; 987 if (ath9k_hif_usb_init() < 0) {
991
992 error = ath9k_htc_debug_create_root();
993 if (error < 0) {
994 printk(KERN_ERR
995 "ath9k_htc: Unable to create debugfs root: %d\n",
996 error);
997 goto err_dbg;
998 }
999
1000 error = ath9k_hif_usb_init();
1001 if (error < 0) {
1002 printk(KERN_ERR 988 printk(KERN_ERR
1003 "ath9k_htc: No USB devices found," 989 "ath9k_htc: No USB devices found,"
1004 " driver not installed.\n"); 990 " driver not installed.\n");
1005 error = -ENODEV; 991 return -ENODEV;
1006 goto err_usb;
1007 } 992 }
1008 993
1009 return 0; 994 return 0;
1010
1011err_usb:
1012 ath9k_htc_debug_remove_root();
1013err_dbg:
1014 return error;
1015} 995}
1016module_init(ath9k_htc_init); 996module_init(ath9k_htc_init);
1017 997
1018static void __exit ath9k_htc_exit(void) 998static void __exit ath9k_htc_exit(void)
1019{ 999{
1020 ath9k_hif_usb_exit(); 1000 ath9k_hif_usb_exit();
1021 ath9k_htc_debug_remove_root();
1022 printk(KERN_INFO "ath9k_htc: Driver unloaded\n"); 1001 printk(KERN_INFO "ath9k_htc: Driver unloaded\n");
1023} 1002}
1024module_exit(ath9k_htc_exit); 1003module_exit(ath9k_htc_exit);