diff options
author | Arend van Spriel <arend@broadcom.com> | 2014-12-27 08:13:00 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-15 07:38:46 -0500 |
commit | 4447d815fd0f89d64b78011e82c18c7e83f7f29e (patch) | |
tree | 1109e325d849f9b3785086c4965126d1008214e1 | |
parent | bd33273b652c85fd6c9e251cebd4362c72718639 (diff) |
ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
Use the helper to get rid of the file operations per debugfs file. The
device driver data contains struct ieee80211_hw pointer and the
struct ath9k_softc pointer is assigned to ieee80211_hw::priv so it can
be accessed in the seq_file read operation.
Cc: ath9k-devel@lists.ath9k.org
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 129 |
1 files changed, 29 insertions, 100 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index c43e2ad36587..1bed9d7589af 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -403,7 +403,8 @@ static const struct file_operations fops_antenna_diversity = { | |||
403 | 403 | ||
404 | static int read_file_dma(struct seq_file *file, void *data) | 404 | static int read_file_dma(struct seq_file *file, void *data) |
405 | { | 405 | { |
406 | struct ath_softc *sc = file->private; | 406 | struct ieee80211_hw *hw = dev_get_drvdata(file->private); |
407 | struct ath_softc *sc = hw->priv; | ||
407 | struct ath_hw *ah = sc->sc_ah; | 408 | struct ath_hw *ah = sc->sc_ah; |
408 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; | 409 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; |
409 | int i, qcuOffset = 0, dcuOffset = 0; | 410 | int i, qcuOffset = 0, dcuOffset = 0; |
@@ -470,20 +471,6 @@ static int read_file_dma(struct seq_file *file, void *data) | |||
470 | return 0; | 471 | return 0; |
471 | } | 472 | } |
472 | 473 | ||
473 | static int open_file_dma(struct inode *inode, struct file *f) | ||
474 | { | ||
475 | return single_open(f, read_file_dma, inode->i_private); | ||
476 | } | ||
477 | |||
478 | static const struct file_operations fops_dma = { | ||
479 | .open = open_file_dma, | ||
480 | .read = seq_read, | ||
481 | .owner = THIS_MODULE, | ||
482 | .llseek = seq_lseek, | ||
483 | .release = single_release, | ||
484 | }; | ||
485 | |||
486 | |||
487 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) | 474 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) |
488 | { | 475 | { |
489 | if (status) | 476 | if (status) |
@@ -539,7 +526,8 @@ void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) | |||
539 | 526 | ||
540 | static int read_file_interrupt(struct seq_file *file, void *data) | 527 | static int read_file_interrupt(struct seq_file *file, void *data) |
541 | { | 528 | { |
542 | struct ath_softc *sc = file->private; | 529 | struct ieee80211_hw *hw = dev_get_drvdata(file->private); |
530 | struct ath_softc *sc = hw->priv; | ||
543 | 531 | ||
544 | #define PR_IS(a, s) \ | 532 | #define PR_IS(a, s) \ |
545 | do { \ | 533 | do { \ |
@@ -600,22 +588,10 @@ static int read_file_interrupt(struct seq_file *file, void *data) | |||
600 | return 0; | 588 | return 0; |
601 | } | 589 | } |
602 | 590 | ||
603 | static int open_file_interrupt(struct inode *inode, struct file *f) | ||
604 | { | ||
605 | return single_open(f, read_file_interrupt, inode->i_private); | ||
606 | } | ||
607 | |||
608 | static const struct file_operations fops_interrupt = { | ||
609 | .read = seq_read, | ||
610 | .open = open_file_interrupt, | ||
611 | .owner = THIS_MODULE, | ||
612 | .llseek = seq_lseek, | ||
613 | .release = single_release, | ||
614 | }; | ||
615 | |||
616 | static int read_file_xmit(struct seq_file *file, void *data) | 591 | static int read_file_xmit(struct seq_file *file, void *data) |
617 | { | 592 | { |
618 | struct ath_softc *sc = file->private; | 593 | struct ieee80211_hw *hw = dev_get_drvdata(file->private); |
594 | struct ath_softc *sc = hw->priv; | ||
619 | 595 | ||
620 | seq_printf(file, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO"); | 596 | seq_printf(file, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO"); |
621 | 597 | ||
@@ -661,7 +637,8 @@ static void print_queue(struct ath_softc *sc, struct ath_txq *txq, | |||
661 | 637 | ||
662 | static int read_file_queues(struct seq_file *file, void *data) | 638 | static int read_file_queues(struct seq_file *file, void *data) |
663 | { | 639 | { |
664 | struct ath_softc *sc = file->private; | 640 | struct ieee80211_hw *hw = dev_get_drvdata(file->private); |
641 | struct ath_softc *sc = hw->priv; | ||
665 | struct ath_txq *txq; | 642 | struct ath_txq *txq; |
666 | int i; | 643 | int i; |
667 | static const char *qname[4] = { | 644 | static const char *qname[4] = { |
@@ -682,7 +659,8 @@ static int read_file_queues(struct seq_file *file, void *data) | |||
682 | 659 | ||
683 | static int read_file_misc(struct seq_file *file, void *data) | 660 | static int read_file_misc(struct seq_file *file, void *data) |
684 | { | 661 | { |
685 | struct ath_softc *sc = file->private; | 662 | struct ieee80211_hw *hw = dev_get_drvdata(file->private); |
663 | struct ath_softc *sc = hw->priv; | ||
686 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 664 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
687 | struct ath9k_vif_iter_data iter_data; | 665 | struct ath9k_vif_iter_data iter_data; |
688 | struct ath_chanctx *ctx; | 666 | struct ath_chanctx *ctx; |
@@ -773,7 +751,8 @@ static int read_file_misc(struct seq_file *file, void *data) | |||
773 | 751 | ||
774 | static int read_file_reset(struct seq_file *file, void *data) | 752 | static int read_file_reset(struct seq_file *file, void *data) |
775 | { | 753 | { |
776 | struct ath_softc *sc = file->private; | 754 | struct ieee80211_hw *hw = dev_get_drvdata(file->private); |
755 | struct ath_softc *sc = hw->priv; | ||
777 | static const char * const reset_cause[__RESET_TYPE_MAX] = { | 756 | static const char * const reset_cause[__RESET_TYPE_MAX] = { |
778 | [RESET_TYPE_BB_HANG] = "Baseband Hang", | 757 | [RESET_TYPE_BB_HANG] = "Baseband Hang", |
779 | [RESET_TYPE_BB_WATCHDOG] = "Baseband Watchdog", | 758 | [RESET_TYPE_BB_WATCHDOG] = "Baseband Watchdog", |
@@ -837,58 +816,6 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, | |||
837 | TX_STAT_INC(qnum, delim_underrun); | 816 | TX_STAT_INC(qnum, delim_underrun); |
838 | } | 817 | } |
839 | 818 | ||
840 | static int open_file_xmit(struct inode *inode, struct file *f) | ||
841 | { | ||
842 | return single_open(f, read_file_xmit, inode->i_private); | ||
843 | } | ||
844 | |||
845 | static const struct file_operations fops_xmit = { | ||
846 | .read = seq_read, | ||
847 | .open = open_file_xmit, | ||
848 | .owner = THIS_MODULE, | ||
849 | .llseek = seq_lseek, | ||
850 | .release = single_release, | ||
851 | }; | ||
852 | |||
853 | static int open_file_queues(struct inode *inode, struct file *f) | ||
854 | { | ||
855 | return single_open(f, read_file_queues, inode->i_private); | ||
856 | } | ||
857 | |||
858 | static const struct file_operations fops_queues = { | ||
859 | .read = seq_read, | ||
860 | .open = open_file_queues, | ||
861 | .owner = THIS_MODULE, | ||
862 | .llseek = seq_lseek, | ||
863 | .release = single_release, | ||
864 | }; | ||
865 | |||
866 | static int open_file_misc(struct inode *inode, struct file *f) | ||
867 | { | ||
868 | return single_open(f, read_file_misc, inode->i_private); | ||
869 | } | ||
870 | |||
871 | static const struct file_operations fops_misc = { | ||
872 | .read = seq_read, | ||
873 | .open = open_file_misc, | ||
874 | .owner = THIS_MODULE, | ||
875 | .llseek = seq_lseek, | ||
876 | .release = single_release, | ||
877 | }; | ||
878 | |||
879 | static int open_file_reset(struct inode *inode, struct file *f) | ||
880 | { | ||
881 | return single_open(f, read_file_reset, inode->i_private); | ||
882 | } | ||
883 | |||
884 | static const struct file_operations fops_reset = { | ||
885 | .read = seq_read, | ||
886 | .open = open_file_reset, | ||
887 | .owner = THIS_MODULE, | ||
888 | .llseek = seq_lseek, | ||
889 | .release = single_release, | ||
890 | }; | ||
891 | |||
892 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) | 819 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) |
893 | { | 820 | { |
894 | ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs); | 821 | ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs); |
@@ -1018,7 +945,8 @@ static const struct file_operations fops_regdump = { | |||
1018 | 945 | ||
1019 | static int read_file_dump_nfcal(struct seq_file *file, void *data) | 946 | static int read_file_dump_nfcal(struct seq_file *file, void *data) |
1020 | { | 947 | { |
1021 | struct ath_softc *sc = file->private; | 948 | struct ieee80211_hw *hw = dev_get_drvdata(file->private); |
949 | struct ath_softc *sc = hw->priv; | ||
1022 | struct ath_hw *ah = sc->sc_ah; | 950 | struct ath_hw *ah = sc->sc_ah; |
1023 | struct ath9k_nfcal_hist *h = sc->cur_chan->caldata.nfCalHist; | 951 | struct ath9k_nfcal_hist *h = sc->cur_chan->caldata.nfCalHist; |
1024 | struct ath_common *common = ath9k_hw_common(ah); | 952 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -1329,14 +1257,14 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1329 | ath9k_tx99_init_debug(sc); | 1257 | ath9k_tx99_init_debug(sc); |
1330 | ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); | 1258 | ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); |
1331 | 1259 | ||
1332 | debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, | 1260 | debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, |
1333 | &fops_dma); | 1261 | read_file_dma); |
1334 | debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, | 1262 | debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, |
1335 | &fops_interrupt); | 1263 | read_file_interrupt); |
1336 | debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc, | 1264 | debugfs_create_devm_seqfile(sc->dev, "xmit", sc->debug.debugfs_phy, |
1337 | &fops_xmit); | 1265 | read_file_xmit); |
1338 | debugfs_create_file("queues", S_IRUSR, sc->debug.debugfs_phy, sc, | 1266 | debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy, |
1339 | &fops_queues); | 1267 | read_file_queues); |
1340 | debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1268 | debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1341 | &sc->tx.txq_max_pending[IEEE80211_AC_BK]); | 1269 | &sc->tx.txq_max_pending[IEEE80211_AC_BK]); |
1342 | debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1270 | debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
@@ -1345,10 +1273,10 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1345 | &sc->tx.txq_max_pending[IEEE80211_AC_VI]); | 1273 | &sc->tx.txq_max_pending[IEEE80211_AC_VI]); |
1346 | debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1274 | debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1347 | &sc->tx.txq_max_pending[IEEE80211_AC_VO]); | 1275 | &sc->tx.txq_max_pending[IEEE80211_AC_VO]); |
1348 | debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc, | 1276 | debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy, |
1349 | &fops_misc); | 1277 | read_file_misc); |
1350 | debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, | 1278 | debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy, |
1351 | &fops_reset); | 1279 | read_file_reset); |
1352 | 1280 | ||
1353 | ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); | 1281 | ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
1354 | ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); | 1282 | ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); |
@@ -1370,8 +1298,9 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1370 | &ah->config.cwm_ignore_extcca); | 1298 | &ah->config.cwm_ignore_extcca); |
1371 | debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc, | 1299 | debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc, |
1372 | &fops_regdump); | 1300 | &fops_regdump); |
1373 | debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, | 1301 | debugfs_create_devm_seqfile(sc->dev, "dump_nfcal", |
1374 | &fops_dump_nfcal); | 1302 | sc->debug.debugfs_phy, |
1303 | read_file_dump_nfcal); | ||
1375 | 1304 | ||
1376 | ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); | 1305 | ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |
1377 | ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); | 1306 | ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); |