1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -75,6 +75,90 @@ static const struct file_operations fops
7 +static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
8 + size_t count, loff_t *ppos)
10 + struct ath_softc *sc = file->private_data;
11 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
15 + len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask);
16 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
19 +static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf,
20 + size_t count, loff_t *ppos)
22 + struct ath_softc *sc = file->private_data;
23 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
28 + len = min(count, sizeof(buf) - 1);
29 + if (copy_from_user(buf, user_buf, len))
33 + if (strict_strtoul(buf, 0, &mask))
36 + common->tx_chainmask = mask;
37 + sc->sc_ah->caps.tx_chainmask = mask;
41 +static const struct file_operations fops_tx_chainmask = {
42 + .read = read_file_tx_chainmask,
43 + .write = write_file_tx_chainmask,
44 + .open = ath9k_debugfs_open,
45 + .owner = THIS_MODULE
49 +static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
50 + size_t count, loff_t *ppos)
52 + struct ath_softc *sc = file->private_data;
53 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
57 + len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask);
58 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
61 +static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf,
62 + size_t count, loff_t *ppos)
64 + struct ath_softc *sc = file->private_data;
65 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
70 + len = min(count, sizeof(buf) - 1);
71 + if (copy_from_user(buf, user_buf, len))
75 + if (strict_strtoul(buf, 0, &mask))
78 + common->rx_chainmask = mask;
79 + sc->sc_ah->caps.rx_chainmask = mask;
83 +static const struct file_operations fops_rx_chainmask = {
84 + .read = read_file_rx_chainmask,
85 + .write = write_file_rx_chainmask,
86 + .open = ath9k_debugfs_open,
87 + .owner = THIS_MODULE
91 static ssize_t read_file_dma(struct file *file, char __user *user_buf,
92 size_t count, loff_t *ppos)
94 @@ -574,6 +658,16 @@ int ath9k_init_debug(struct ath_hw *ah)
98 + sc->debug.debugfs_rx_chainmask = debugfs_create_file("rx_chainmask",
99 + S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
100 + if (!sc->debug.debugfs_rx_chainmask)
103 + sc->debug.debugfs_tx_chainmask = debugfs_create_file("tx_chainmask",
104 + S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
105 + if (!sc->debug.debugfs_tx_chainmask)
108 sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR,
109 sc->debug.debugfs_phy, sc, &fops_dma);
110 if (!sc->debug.debugfs_dma)
111 @@ -617,6 +711,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
112 struct ath_common *common = ath9k_hw_common(ah);
113 struct ath_softc *sc = (struct ath_softc *) common->priv;
115 + debugfs_remove(sc->debug.debugfs_tx_chainmask);
116 + debugfs_remove(sc->debug.debugfs_rx_chainmask);
117 debugfs_remove(sc->debug.debugfs_xmit);
118 debugfs_remove(sc->debug.debugfs_wiphy);
119 debugfs_remove(sc->debug.debugfs_rcstat);
120 --- a/drivers/net/wireless/ath/ath9k/debug.h
121 +++ b/drivers/net/wireless/ath/ath9k/debug.h
122 @@ -123,6 +123,8 @@ struct ath_stats {
126 + struct dentry *debugfs_rx_chainmask;
127 + struct dentry *debugfs_tx_chainmask;
128 struct dentry *debugfs_phy;
129 struct dentry *debugfs_debug;
130 struct dentry *debugfs_dma;