aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-01-06 09:47:15 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-01-06 09:47:15 -0500
commit4cd3c4ecfcbf07fe58ce7de4de61cf85ddc10e78 (patch)
tree1cf4926db5d89305e43d6ee1be3590a97df3b9cf /net/mac80211
parente03ad6eade141daf0df07f1c312e8ae702327939 (diff)
mac80211: clean up netdev debugfs macros a bit
Clean up the file macros a bit and use that to remove the unnecessary format function for the tkip MIC test file that really is write-only. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/debugfs_netdev.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 04b5a14c8a05..b62cbe82954c 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -133,7 +133,15 @@ static ssize_t ieee80211_if_fmt_##name( \
133 jiffies_to_msecs(sdata->field)); \ 133 jiffies_to_msecs(sdata->field)); \
134} 134}
135 135
136#define __IEEE80211_IF_FILE(name, _write) \ 136#define _IEEE80211_IF_FILE_OPS(name, _read, _write) \
137static const struct file_operations name##_ops = { \
138 .read = (_read), \
139 .write = (_write), \
140 .open = simple_open, \
141 .llseek = generic_file_llseek, \
142}
143
144#define _IEEE80211_IF_FILE_R_FN(name) \
137static ssize_t ieee80211_if_read_##name(struct file *file, \ 145static ssize_t ieee80211_if_read_##name(struct file *file, \
138 char __user *userbuf, \ 146 char __user *userbuf, \
139 size_t count, loff_t *ppos) \ 147 size_t count, loff_t *ppos) \
@@ -141,28 +149,34 @@ static ssize_t ieee80211_if_read_##name(struct file *file, \
141 return ieee80211_if_read(file->private_data, \ 149 return ieee80211_if_read(file->private_data, \
142 userbuf, count, ppos, \ 150 userbuf, count, ppos, \
143 ieee80211_if_fmt_##name); \ 151 ieee80211_if_fmt_##name); \
144} \
145static const struct file_operations name##_ops = { \
146 .read = ieee80211_if_read_##name, \
147 .write = (_write), \
148 .open = simple_open, \
149 .llseek = generic_file_llseek, \
150} 152}
151 153
152#define __IEEE80211_IF_FILE_W(name) \ 154#define _IEEE80211_IF_FILE_W_FN(name) \
153static ssize_t ieee80211_if_write_##name(struct file *file, \ 155static ssize_t ieee80211_if_write_##name(struct file *file, \
154 const char __user *userbuf, \ 156 const char __user *userbuf, \
155 size_t count, loff_t *ppos) \ 157 size_t count, loff_t *ppos) \
156{ \ 158{ \
157 return ieee80211_if_write(file->private_data, userbuf, count, \ 159 return ieee80211_if_write(file->private_data, userbuf, count, \
158 ppos, ieee80211_if_parse_##name); \ 160 ppos, ieee80211_if_parse_##name); \
159} \ 161}
160__IEEE80211_IF_FILE(name, ieee80211_if_write_##name) 162
163#define IEEE80211_IF_FILE_R(name) \
164 _IEEE80211_IF_FILE_R_FN(name) \
165 _IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, NULL)
166
167#define IEEE80211_IF_FILE_W(name) \
168 _IEEE80211_IF_FILE_W_FN(name) \
169 _IEEE80211_IF_FILE_OPS(name, NULL, ieee80211_if_write_##name)
161 170
171#define IEEE80211_IF_FILE_RW(name) \
172 _IEEE80211_IF_FILE_R_FN(name) \
173 _IEEE80211_IF_FILE_W_FN(name) \
174 _IEEE80211_IF_FILE_OPS(name, ieee80211_if_read_##name, \
175 ieee80211_if_write_##name)
162 176
163#define IEEE80211_IF_FILE(name, field, format) \ 177#define IEEE80211_IF_FILE(name, field, format) \
164 IEEE80211_IF_FMT_##format(name, field) \ 178 IEEE80211_IF_FMT_##format(name, field) \
165 __IEEE80211_IF_FILE(name, NULL) 179 IEEE80211_IF_FILE_R(name)
166 180
167/* common attributes */ 181/* common attributes */
168IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); 182IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
@@ -199,7 +213,7 @@ ieee80211_if_fmt_hw_queues(const struct ieee80211_sub_if_data *sdata,
199 213
200 return len; 214 return len;
201} 215}
202__IEEE80211_IF_FILE(hw_queues, NULL); 216IEEE80211_IF_FILE_R(hw_queues);
203 217
204/* STA attributes */ 218/* STA attributes */
205IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC); 219IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
@@ -275,14 +289,7 @@ static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata,
275 289
276 return -EINVAL; 290 return -EINVAL;
277} 291}
278 292IEEE80211_IF_FILE_RW(smps);
279__IEEE80211_IF_FILE_W(smps);
280
281static ssize_t ieee80211_if_fmt_tkip_mic_test(
282 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
283{
284 return -EOPNOTSUPP;
285}
286 293
287static ssize_t ieee80211_if_parse_tkip_mic_test( 294static ssize_t ieee80211_if_parse_tkip_mic_test(
288 struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) 295 struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
@@ -349,8 +356,7 @@ static ssize_t ieee80211_if_parse_tkip_mic_test(
349 356
350 return buflen; 357 return buflen;
351} 358}
352 359IEEE80211_IF_FILE_W(tkip_mic_test);
353__IEEE80211_IF_FILE_W(tkip_mic_test);
354 360
355static ssize_t ieee80211_if_fmt_uapsd_queues( 361static ssize_t ieee80211_if_fmt_uapsd_queues(
356 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) 362 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
@@ -378,7 +384,7 @@ static ssize_t ieee80211_if_parse_uapsd_queues(
378 384
379 return buflen; 385 return buflen;
380} 386}
381__IEEE80211_IF_FILE_W(uapsd_queues); 387IEEE80211_IF_FILE_RW(uapsd_queues);
382 388
383static ssize_t ieee80211_if_fmt_uapsd_max_sp_len( 389static ssize_t ieee80211_if_fmt_uapsd_max_sp_len(
384 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) 390 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
@@ -406,7 +412,7 @@ static ssize_t ieee80211_if_parse_uapsd_max_sp_len(
406 412
407 return buflen; 413 return buflen;
408} 414}
409__IEEE80211_IF_FILE_W(uapsd_max_sp_len); 415IEEE80211_IF_FILE_RW(uapsd_max_sp_len);
410 416
411/* AP attributes */ 417/* AP attributes */
412IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC); 418IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC);
@@ -419,7 +425,7 @@ static ssize_t ieee80211_if_fmt_num_buffered_multicast(
419 return scnprintf(buf, buflen, "%u\n", 425 return scnprintf(buf, buflen, "%u\n",
420 skb_queue_len(&sdata->u.ap.ps.bc_buf)); 426 skb_queue_len(&sdata->u.ap.ps.bc_buf));
421} 427}
422__IEEE80211_IF_FILE(num_buffered_multicast, NULL); 428IEEE80211_IF_FILE_R(num_buffered_multicast);
423 429
424/* IBSS attributes */ 430/* IBSS attributes */
425static ssize_t ieee80211_if_fmt_tsf( 431static ssize_t ieee80211_if_fmt_tsf(
@@ -470,7 +476,7 @@ static ssize_t ieee80211_if_parse_tsf(
470 476
471 return buflen; 477 return buflen;
472} 478}
473__IEEE80211_IF_FILE_W(tsf); 479IEEE80211_IF_FILE_RW(tsf);
474 480
475 481
476/* WDS attributes */ 482/* WDS attributes */