aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/debug.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-08-13 06:33:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-08-15 16:07:58 -0400
commitca6d4a74c4dea24277d4ce2df4940da6003a2a16 (patch)
treed60b58624f02e4d33df67a44af29940f2679d3b3 /drivers/net/wireless/ath/ath9k/debug.c
parentf5bde5b8524fb2b8584af3750dbffda6557234e6 (diff)
ath9k: simplify debugfs chainmask handling
Writing to that file is unnecessary and quirky, the antenna API should be used instead. Use debugfs_create_u8 to allow reading the values. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c92
1 files changed, 4 insertions, 88 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index e5c8333eb55a..c088744a6bfb 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -88,90 +88,6 @@ static const struct file_operations fops_debug = {
88 88
89#define DMA_BUF_LEN 1024 89#define DMA_BUF_LEN 1024
90 90
91static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
92 size_t count, loff_t *ppos)
93{
94 struct ath_softc *sc = file->private_data;
95 struct ath_hw *ah = sc->sc_ah;
96 char buf[32];
97 unsigned int len;
98
99 len = sprintf(buf, "0x%08x\n", ah->txchainmask);
100 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
101}
102
103static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf,
104 size_t count, loff_t *ppos)
105{
106 struct ath_softc *sc = file->private_data;
107 struct ath_hw *ah = sc->sc_ah;
108 unsigned long mask;
109 char buf[32];
110 ssize_t len;
111
112 len = min(count, sizeof(buf) - 1);
113 if (copy_from_user(buf, user_buf, len))
114 return -EFAULT;
115
116 buf[len] = '\0';
117 if (kstrtoul(buf, 0, &mask))
118 return -EINVAL;
119
120 ah->txchainmask = mask;
121 ah->caps.tx_chainmask = mask;
122 return count;
123}
124
125static const struct file_operations fops_tx_chainmask = {
126 .read = read_file_tx_chainmask,
127 .write = write_file_tx_chainmask,
128 .open = simple_open,
129 .owner = THIS_MODULE,
130 .llseek = default_llseek,
131};
132
133
134static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
135 size_t count, loff_t *ppos)
136{
137 struct ath_softc *sc = file->private_data;
138 struct ath_hw *ah = sc->sc_ah;
139 char buf[32];
140 unsigned int len;
141
142 len = sprintf(buf, "0x%08x\n", ah->rxchainmask);
143 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
144}
145
146static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf,
147 size_t count, loff_t *ppos)
148{
149 struct ath_softc *sc = file->private_data;
150 struct ath_hw *ah = sc->sc_ah;
151 unsigned long mask;
152 char buf[32];
153 ssize_t len;
154
155 len = min(count, sizeof(buf) - 1);
156 if (copy_from_user(buf, user_buf, len))
157 return -EFAULT;
158
159 buf[len] = '\0';
160 if (kstrtoul(buf, 0, &mask))
161 return -EINVAL;
162
163 ah->rxchainmask = mask;
164 ah->caps.rx_chainmask = mask;
165 return count;
166}
167
168static const struct file_operations fops_rx_chainmask = {
169 .read = read_file_rx_chainmask,
170 .write = write_file_rx_chainmask,
171 .open = simple_open,
172 .owner = THIS_MODULE,
173 .llseek = default_llseek,
174};
175 91
176static ssize_t read_file_ani(struct file *file, char __user *user_buf, 92static ssize_t read_file_ani(struct file *file, char __user *user_buf,
177 size_t count, loff_t *ppos) 93 size_t count, loff_t *ppos)
@@ -1896,10 +1812,10 @@ int ath9k_init_debug(struct ath_hw *ah)
1896 &fops_reset); 1812 &fops_reset);
1897 debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, 1813 debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc,
1898 &fops_recv); 1814 &fops_recv);
1899 debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, 1815 debugfs_create_u8("rx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
1900 sc->debug.debugfs_phy, sc, &fops_rx_chainmask); 1816 &ah->rxchainmask);
1901 debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, 1817 debugfs_create_u8("tx_chainmask", S_IRUSR, sc->debug.debugfs_phy,
1902 sc->debug.debugfs_phy, sc, &fops_tx_chainmask); 1818 &ah->txchainmask);
1903 debugfs_create_file("ani", S_IRUSR | S_IWUSR, 1819 debugfs_create_file("ani", S_IRUSR | S_IWUSR,
1904 sc->debug.debugfs_phy, sc, &fops_ani); 1820 sc->debug.debugfs_phy, sc, &fops_ani);
1905 debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, 1821 debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,