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

ath9k: move recv to ath9k_cmn_debug_recv

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Oleksij Rempel and committed by
John W. Linville
87ea9b0b b5a0c86a

+68 -57
+63
drivers/net/wireless/ath/ath9k/common-debug.c
··· 119 119 #undef RX_PHY_ERR_INC 120 120 } 121 121 EXPORT_SYMBOL(ath9k_cmn_debug_stat_rx); 122 + 123 + static ssize_t read_file_recv(struct file *file, char __user *user_buf, 124 + size_t count, loff_t *ppos) 125 + { 126 + #define RXS_ERR(s, e) \ 127 + do { \ 128 + len += scnprintf(buf + len, size - len, \ 129 + "%18s : %10u\n", s, \ 130 + rxstats->e); \ 131 + } while (0) 132 + 133 + struct ath_rx_stats *rxstats = file->private_data; 134 + char *buf; 135 + unsigned int len = 0, size = 1600; 136 + ssize_t retval = 0; 137 + 138 + buf = kzalloc(size, GFP_KERNEL); 139 + if (buf == NULL) 140 + return -ENOMEM; 141 + 142 + RXS_ERR("PKTS-ALL", rx_pkts_all); 143 + RXS_ERR("BYTES-ALL", rx_bytes_all); 144 + RXS_ERR("BEACONS", rx_beacons); 145 + RXS_ERR("FRAGS", rx_frags); 146 + RXS_ERR("SPECTRAL", rx_spectral); 147 + 148 + RXS_ERR("CRC ERR", crc_err); 149 + RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); 150 + RXS_ERR("PHY ERR", phy_err); 151 + RXS_ERR("MIC ERR", mic_err); 152 + RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); 153 + RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); 154 + RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); 155 + RXS_ERR("LENGTH-ERR", rx_len_err); 156 + RXS_ERR("OOM-ERR", rx_oom_err); 157 + RXS_ERR("RATE-ERR", rx_rate_err); 158 + RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); 159 + 160 + if (len > size) 161 + len = size; 162 + 163 + retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 164 + kfree(buf); 165 + 166 + return retval; 167 + 168 + #undef RXS_ERR 169 + } 170 + 171 + static const struct file_operations fops_recv = { 172 + .read = read_file_recv, 173 + .open = simple_open, 174 + .owner = THIS_MODULE, 175 + .llseek = default_llseek, 176 + }; 177 + 178 + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, 179 + struct ath_rx_stats *rxstats) 180 + { 181 + debugfs_create_file("recv", S_IRUSR, debugfs_phy, rxstats, 182 + &fops_recv); 183 + } 184 + EXPORT_SYMBOL(ath9k_cmn_debug_recv);
+2
drivers/net/wireless/ath/ath9k/common-debug.h
··· 66 66 struct ath_hw *ah); 67 67 void ath9k_cmn_debug_stat_rx(struct ath_rx_stats *rxstats, 68 68 struct ath_rx_status *rs); 69 + void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, 70 + struct ath_rx_stats *rxstats);
+3 -57
drivers/net/wireless/ath/ath9k/debug.c
··· 948 948 .llseek = default_llseek, 949 949 }; 950 950 951 - static ssize_t read_file_recv(struct file *file, char __user *user_buf, 952 - size_t count, loff_t *ppos) 953 - { 954 - #define RXS_ERR(s, e) \ 955 - do { \ 956 - len += scnprintf(buf + len, size - len, \ 957 - "%18s : %10u\n", s, \ 958 - sc->debug.stats.rxstats.e);\ 959 - } while (0) 960 - 961 - struct ath_softc *sc = file->private_data; 962 - char *buf; 963 - unsigned int len = 0, size = 1600; 964 - ssize_t retval = 0; 965 - 966 - buf = kzalloc(size, GFP_KERNEL); 967 - if (buf == NULL) 968 - return -ENOMEM; 969 - 970 - RXS_ERR("PKTS-ALL", rx_pkts_all); 971 - RXS_ERR("BYTES-ALL", rx_bytes_all); 972 - RXS_ERR("BEACONS", rx_beacons); 973 - RXS_ERR("FRAGS", rx_frags); 974 - RXS_ERR("SPECTRAL", rx_spectral); 975 - 976 - RXS_ERR("CRC ERR", crc_err); 977 - RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); 978 - RXS_ERR("PHY ERR", phy_err); 979 - RXS_ERR("MIC ERR", mic_err); 980 - RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); 981 - RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); 982 - RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); 983 - RXS_ERR("LENGTH-ERR", rx_len_err); 984 - RXS_ERR("OOM-ERR", rx_oom_err); 985 - RXS_ERR("RATE-ERR", rx_rate_err); 986 - RXS_ERR("TOO-MANY-FRAGS", rx_too_many_frags_err); 987 - 988 - if (len > size) 989 - len = size; 990 - 991 - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 992 - kfree(buf); 993 - 994 - return retval; 995 - 996 - #undef RXS_ERR 997 - } 998 - 999 951 void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) 1000 952 { 1001 953 ath9k_cmn_debug_stat_rx(&sc->debug.stats.rxstats, rs); 1002 954 } 1003 - 1004 - static const struct file_operations fops_recv = { 1005 - .read = read_file_recv, 1006 - .open = simple_open, 1007 - .owner = THIS_MODULE, 1008 - .llseek = default_llseek, 1009 - }; 1010 955 1011 956 static ssize_t read_file_phy_err(struct file *file, char __user *user_buf, 1012 957 size_t count, loff_t *ppos) ··· 1389 1444 &fops_misc); 1390 1445 debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, 1391 1446 &fops_reset); 1392 - debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, 1393 - &fops_recv); 1447 + 1448 + ath9k_cmn_debug_recv(sc->debug.debugfs_phy, &sc->debug.stats.rxstats); 1449 + 1394 1450 debugfs_create_file("phy_err", S_IRUSR, sc->debug.debugfs_phy, sc, 1395 1451 &fops_phy_err); 1396 1452 debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy,