Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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
struct ath9k_softc pointer is set as device driver data to be obtained
in the seq_file read operation.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Arend van Spriel and committed by
Greg Kroah-Hartman
d32394fa 631bee25

+24 -100
+1
drivers/net/wireless/ath/ath9k/ahb.c
··· 126 126 sc = hw->priv; 127 127 sc->hw = hw; 128 128 sc->dev = &pdev->dev; 129 + dev_set_drvdata(sc->dev, sc); 129 130 sc->mem = mem; 130 131 sc->irq = irq; 131 132
+22 -100
drivers/net/wireless/ath/ath9k/debug.c
··· 403 403 404 404 static int read_file_dma(struct seq_file *file, void *data) 405 405 { 406 - struct ath_softc *sc = file->private; 406 + struct ath_softc *sc = dev_get_drvdata(file->private); 407 407 struct ath_hw *ah = sc->sc_ah; 408 408 u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; 409 409 int i, qcuOffset = 0, dcuOffset = 0; ··· 470 470 return 0; 471 471 } 472 472 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 473 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) 488 474 { 489 475 if (status) ··· 525 539 526 540 static int read_file_interrupt(struct seq_file *file, void *data) 527 541 { 528 - struct ath_softc *sc = file->private; 542 + struct ath_softc *sc = dev_get_drvdata(file->private); 529 543 530 544 #define PR_IS(a, s) \ 531 545 do { \ ··· 586 600 return 0; 587 601 } 588 602 589 - static int open_file_interrupt(struct inode *inode, struct file *f) 590 - { 591 - return single_open(f, read_file_interrupt, inode->i_private); 592 - } 593 - 594 - static const struct file_operations fops_interrupt = { 595 - .read = seq_read, 596 - .open = open_file_interrupt, 597 - .owner = THIS_MODULE, 598 - .llseek = seq_lseek, 599 - .release = single_release, 600 - }; 601 - 602 603 static int read_file_xmit(struct seq_file *file, void *data) 603 604 { 604 - struct ath_softc *sc = file->private; 605 + struct ath_softc *sc = dev_get_drvdata(file->private); 605 606 606 607 seq_printf(file, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO"); 607 608 ··· 634 661 635 662 static int read_file_queues(struct seq_file *file, void *data) 636 663 { 637 - struct ath_softc *sc = file->private; 664 + struct ath_softc *sc = dev_get_drvdata(file->private); 638 665 struct ath_txq *txq; 639 666 int i; 640 667 static const char *qname[4] = { ··· 655 682 656 683 static int read_file_misc(struct seq_file *file, void *data) 657 684 { 658 - struct ath_softc *sc = file->private; 685 + struct ath_softc *sc = dev_get_drvdata(file->private); 659 686 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 660 687 struct ath9k_vif_iter_data iter_data; 661 688 struct ath_chanctx *ctx; ··· 745 772 746 773 static int read_file_reset(struct seq_file *file, void *data) 747 774 { 748 - struct ath_softc *sc = file->private; 775 + struct ath_softc *sc = dev_get_drvdata(file->private); 749 776 750 777 seq_printf(file, "%17s: %2d\n", "Baseband Hang", 751 778 sc->debug.stats.reset[RESET_TYPE_BB_HANG]); ··· 805 832 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) 806 833 TX_STAT_INC(qnum, delim_underrun); 807 834 } 808 - 809 - static int open_file_xmit(struct inode *inode, struct file *f) 810 - { 811 - return single_open(f, read_file_xmit, inode->i_private); 812 - } 813 - 814 - static const struct file_operations fops_xmit = { 815 - .read = seq_read, 816 - .open = open_file_xmit, 817 - .owner = THIS_MODULE, 818 - .llseek = seq_lseek, 819 - .release = single_release, 820 - }; 821 - 822 - static int open_file_queues(struct inode *inode, struct file *f) 823 - { 824 - return single_open(f, read_file_queues, inode->i_private); 825 - } 826 - 827 - static const struct file_operations fops_queues = { 828 - .read = seq_read, 829 - .open = open_file_queues, 830 - .owner = THIS_MODULE, 831 - .llseek = seq_lseek, 832 - .release = single_release, 833 - }; 834 - 835 - static int open_file_misc(struct inode *inode, struct file *f) 836 - { 837 - return single_open(f, read_file_misc, inode->i_private); 838 - } 839 - 840 - static const struct file_operations fops_misc = { 841 - .read = seq_read, 842 - .open = open_file_misc, 843 - .owner = THIS_MODULE, 844 - .llseek = seq_lseek, 845 - .release = single_release, 846 - }; 847 - 848 - static int open_file_reset(struct inode *inode, struct file *f) 849 - { 850 - return single_open(f, read_file_reset, inode->i_private); 851 - } 852 - 853 - static const struct file_operations fops_reset = { 854 - .read = seq_read, 855 - .open = open_file_reset, 856 - .owner = THIS_MODULE, 857 - .llseek = seq_lseek, 858 - .release = single_release, 859 - }; 860 835 861 836 void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) 862 837 { ··· 935 1014 936 1015 static int read_file_dump_nfcal(struct seq_file *file, void *data) 937 1016 { 938 - struct ath_softc *sc = file->private; 1017 + struct ath_softc *sc = dev_get_drvdata(file->private); 939 1018 struct ath_hw *ah = sc->sc_ah; 940 1019 struct ath9k_nfcal_hist *h = sc->cur_chan->caldata.nfCalHist; 941 1020 struct ath_common *common = ath9k_hw_common(ah); ··· 1177 1256 ath9k_tx99_init_debug(sc); 1178 1257 ath9k_spectral_init_debug(sc); 1179 1258 1180 - debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, 1181 - &fops_dma); 1182 - debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, 1183 - &fops_interrupt); 1184 - debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc, 1185 - &fops_xmit); 1186 - debugfs_create_file("queues", S_IRUSR, sc->debug.debugfs_phy, sc, 1187 - &fops_queues); 1259 + debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, 1260 + read_file_dma); 1261 + debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, 1262 + read_file_interrupt); 1263 + debugfs_create_devm_seqfile(sc->dev, "xmit", sc->debug.debugfs_phy, 1264 + read_file_xmit); 1265 + debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy, 1266 + read_file_queues); 1188 1267 debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, 1189 1268 &sc->tx.txq_max_pending[IEEE80211_AC_BK]); 1190 1269 debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, ··· 1193 1272 &sc->tx.txq_max_pending[IEEE80211_AC_VI]); 1194 1273 debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, 1195 1274 &sc->tx.txq_max_pending[IEEE80211_AC_VO]); 1196 - debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc, 1197 - &fops_misc); 1198 - debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, 1199 - &fops_reset); 1275 + debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy, 1276 + read_file_misc); 1277 + debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy, 1278 + read_file_reset); 1200 1279 1201 1280 ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); 1202 1281 ath9k_cmn_debug_phy_err(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); ··· 1218 1297 &ah->config.cwm_ignore_extcca); 1219 1298 debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc, 1220 1299 &fops_regdump); 1221 - debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, 1222 - &fops_dump_nfcal); 1300 + debugfs_create_devm_seqfile(sc->dev, "dump_nfcal", 1301 + sc->debug.debugfs_phy, 1302 + read_file_dump_nfcal); 1223 1303 1224 1304 ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); 1225 1305 ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah);
+1
drivers/net/wireless/ath/ath9k/pci.c
··· 856 856 sc = hw->priv; 857 857 sc->hw = hw; 858 858 sc->dev = &pdev->dev; 859 + dev_set_drvdata(sc->dev, sc); 859 860 sc->mem = pcim_iomap_table(pdev)[0]; 860 861 sc->driver_data = id->driver_data; 861 862