diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-11 05:05:22 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:24:30 -0400 |
commit | d51269592c327fcfe8ec80fd169a84f8dc0de73b (patch) | |
tree | 0775aaf67c47ea82b20bce6ec375b83c445e663d /drivers/net/wireless/intersil/hostap/hostap_proc.c | |
parent | 7ceed065451aba90cafd9a493c8f62fedd74d457 (diff) |
hostap: switch to proc_create_{seq,single}_data
And use proc private data directly instead of doing a detour
through seq->private.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/net/wireless/intersil/hostap/hostap_proc.c')
-rw-r--r-- | drivers/net/wireless/intersil/hostap/hostap_proc.c | 143 |
1 files changed, 25 insertions, 118 deletions
diff --git a/drivers/net/wireless/intersil/hostap/hostap_proc.c b/drivers/net/wireless/intersil/hostap/hostap_proc.c index d234231bf532..5b33ccab9188 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_proc.c +++ b/drivers/net/wireless/intersil/hostap/hostap_proc.c | |||
@@ -43,18 +43,6 @@ static int prism2_debug_proc_show(struct seq_file *m, void *v) | |||
43 | 43 | ||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | |||
47 | static int prism2_debug_proc_open(struct inode *inode, struct file *file) | ||
48 | { | ||
49 | return single_open(file, prism2_debug_proc_show, PDE_DATA(inode)); | ||
50 | } | ||
51 | |||
52 | static const struct file_operations prism2_debug_proc_fops = { | ||
53 | .open = prism2_debug_proc_open, | ||
54 | .read = seq_read, | ||
55 | .llseek = seq_lseek, | ||
56 | .release = single_release, | ||
57 | }; | ||
58 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 46 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
59 | 47 | ||
60 | 48 | ||
@@ -95,19 +83,6 @@ static int prism2_stats_proc_show(struct seq_file *m, void *v) | |||
95 | return 0; | 83 | return 0; |
96 | } | 84 | } |
97 | 85 | ||
98 | static int prism2_stats_proc_open(struct inode *inode, struct file *file) | ||
99 | { | ||
100 | return single_open(file, prism2_stats_proc_show, PDE_DATA(inode)); | ||
101 | } | ||
102 | |||
103 | static const struct file_operations prism2_stats_proc_fops = { | ||
104 | .open = prism2_stats_proc_open, | ||
105 | .read = seq_read, | ||
106 | .llseek = seq_lseek, | ||
107 | .release = single_release, | ||
108 | }; | ||
109 | |||
110 | |||
111 | static int prism2_wds_proc_show(struct seq_file *m, void *v) | 86 | static int prism2_wds_proc_show(struct seq_file *m, void *v) |
112 | { | 87 | { |
113 | struct list_head *ptr = v; | 88 | struct list_head *ptr = v; |
@@ -122,20 +97,20 @@ static int prism2_wds_proc_show(struct seq_file *m, void *v) | |||
122 | 97 | ||
123 | static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) | 98 | static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) |
124 | { | 99 | { |
125 | local_info_t *local = m->private; | 100 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
126 | read_lock_bh(&local->iface_lock); | 101 | read_lock_bh(&local->iface_lock); |
127 | return seq_list_start(&local->hostap_interfaces, *_pos); | 102 | return seq_list_start(&local->hostap_interfaces, *_pos); |
128 | } | 103 | } |
129 | 104 | ||
130 | static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 105 | static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
131 | { | 106 | { |
132 | local_info_t *local = m->private; | 107 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
133 | return seq_list_next(v, &local->hostap_interfaces, _pos); | 108 | return seq_list_next(v, &local->hostap_interfaces, _pos); |
134 | } | 109 | } |
135 | 110 | ||
136 | static void prism2_wds_proc_stop(struct seq_file *m, void *v) | 111 | static void prism2_wds_proc_stop(struct seq_file *m, void *v) |
137 | { | 112 | { |
138 | local_info_t *local = m->private; | 113 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
139 | read_unlock_bh(&local->iface_lock); | 114 | read_unlock_bh(&local->iface_lock); |
140 | } | 115 | } |
141 | 116 | ||
@@ -146,27 +121,9 @@ static const struct seq_operations prism2_wds_proc_seqops = { | |||
146 | .show = prism2_wds_proc_show, | 121 | .show = prism2_wds_proc_show, |
147 | }; | 122 | }; |
148 | 123 | ||
149 | static int prism2_wds_proc_open(struct inode *inode, struct file *file) | ||
150 | { | ||
151 | int ret = seq_open(file, &prism2_wds_proc_seqops); | ||
152 | if (ret == 0) { | ||
153 | struct seq_file *m = file->private_data; | ||
154 | m->private = PDE_DATA(inode); | ||
155 | } | ||
156 | return ret; | ||
157 | } | ||
158 | |||
159 | static const struct file_operations prism2_wds_proc_fops = { | ||
160 | .open = prism2_wds_proc_open, | ||
161 | .read = seq_read, | ||
162 | .llseek = seq_lseek, | ||
163 | .release = seq_release, | ||
164 | }; | ||
165 | |||
166 | |||
167 | static int prism2_bss_list_proc_show(struct seq_file *m, void *v) | 124 | static int prism2_bss_list_proc_show(struct seq_file *m, void *v) |
168 | { | 125 | { |
169 | local_info_t *local = m->private; | 126 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
170 | struct list_head *ptr = v; | 127 | struct list_head *ptr = v; |
171 | struct hostap_bss_info *bss; | 128 | struct hostap_bss_info *bss; |
172 | 129 | ||
@@ -193,20 +150,20 @@ static int prism2_bss_list_proc_show(struct seq_file *m, void *v) | |||
193 | 150 | ||
194 | static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) | 151 | static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) |
195 | { | 152 | { |
196 | local_info_t *local = m->private; | 153 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
197 | spin_lock_bh(&local->lock); | 154 | spin_lock_bh(&local->lock); |
198 | return seq_list_start_head(&local->bss_list, *_pos); | 155 | return seq_list_start_head(&local->bss_list, *_pos); |
199 | } | 156 | } |
200 | 157 | ||
201 | static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 158 | static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
202 | { | 159 | { |
203 | local_info_t *local = m->private; | 160 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
204 | return seq_list_next(v, &local->bss_list, _pos); | 161 | return seq_list_next(v, &local->bss_list, _pos); |
205 | } | 162 | } |
206 | 163 | ||
207 | static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) | 164 | static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) |
208 | { | 165 | { |
209 | local_info_t *local = m->private; | 166 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
210 | spin_unlock_bh(&local->lock); | 167 | spin_unlock_bh(&local->lock); |
211 | } | 168 | } |
212 | 169 | ||
@@ -217,24 +174,6 @@ static const struct seq_operations prism2_bss_list_proc_seqops = { | |||
217 | .show = prism2_bss_list_proc_show, | 174 | .show = prism2_bss_list_proc_show, |
218 | }; | 175 | }; |
219 | 176 | ||
220 | static int prism2_bss_list_proc_open(struct inode *inode, struct file *file) | ||
221 | { | ||
222 | int ret = seq_open(file, &prism2_bss_list_proc_seqops); | ||
223 | if (ret == 0) { | ||
224 | struct seq_file *m = file->private_data; | ||
225 | m->private = PDE_DATA(inode); | ||
226 | } | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | static const struct file_operations prism2_bss_list_proc_fops = { | ||
231 | .open = prism2_bss_list_proc_open, | ||
232 | .read = seq_read, | ||
233 | .llseek = seq_lseek, | ||
234 | .release = seq_release, | ||
235 | }; | ||
236 | |||
237 | |||
238 | static int prism2_crypt_proc_show(struct seq_file *m, void *v) | 177 | static int prism2_crypt_proc_show(struct seq_file *m, void *v) |
239 | { | 178 | { |
240 | local_info_t *local = m->private; | 179 | local_info_t *local = m->private; |
@@ -252,19 +191,6 @@ static int prism2_crypt_proc_show(struct seq_file *m, void *v) | |||
252 | return 0; | 191 | return 0; |
253 | } | 192 | } |
254 | 193 | ||
255 | static int prism2_crypt_proc_open(struct inode *inode, struct file *file) | ||
256 | { | ||
257 | return single_open(file, prism2_crypt_proc_show, PDE_DATA(inode)); | ||
258 | } | ||
259 | |||
260 | static const struct file_operations prism2_crypt_proc_fops = { | ||
261 | .open = prism2_crypt_proc_open, | ||
262 | .read = seq_read, | ||
263 | .llseek = seq_lseek, | ||
264 | .release = single_release, | ||
265 | }; | ||
266 | |||
267 | |||
268 | static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, | 194 | static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, |
269 | size_t count, loff_t *_pos) | 195 | size_t count, loff_t *_pos) |
270 | { | 196 | { |
@@ -342,7 +268,7 @@ static int prism2_io_debug_proc_read(char *page, char **start, off_t off, | |||
342 | #ifndef PRISM2_NO_STATION_MODES | 268 | #ifndef PRISM2_NO_STATION_MODES |
343 | static int prism2_scan_results_proc_show(struct seq_file *m, void *v) | 269 | static int prism2_scan_results_proc_show(struct seq_file *m, void *v) |
344 | { | 270 | { |
345 | local_info_t *local = m->private; | 271 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
346 | unsigned long entry; | 272 | unsigned long entry; |
347 | int i, len; | 273 | int i, len; |
348 | struct hfa384x_hostscan_result *scanres; | 274 | struct hfa384x_hostscan_result *scanres; |
@@ -392,7 +318,7 @@ static int prism2_scan_results_proc_show(struct seq_file *m, void *v) | |||
392 | 318 | ||
393 | static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) | 319 | static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) |
394 | { | 320 | { |
395 | local_info_t *local = m->private; | 321 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
396 | spin_lock_bh(&local->lock); | 322 | spin_lock_bh(&local->lock); |
397 | 323 | ||
398 | /* We have a header (pos 0) + N results to show (pos 1...N) */ | 324 | /* We have a header (pos 0) + N results to show (pos 1...N) */ |
@@ -403,7 +329,7 @@ static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) | |||
403 | 329 | ||
404 | static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 330 | static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
405 | { | 331 | { |
406 | local_info_t *local = m->private; | 332 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
407 | 333 | ||
408 | ++*_pos; | 334 | ++*_pos; |
409 | if (*_pos > local->last_scan_results_count) | 335 | if (*_pos > local->last_scan_results_count) |
@@ -413,7 +339,7 @@ static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t * | |||
413 | 339 | ||
414 | static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) | 340 | static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) |
415 | { | 341 | { |
416 | local_info_t *local = m->private; | 342 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
417 | spin_unlock_bh(&local->lock); | 343 | spin_unlock_bh(&local->lock); |
418 | } | 344 | } |
419 | 345 | ||
@@ -423,25 +349,6 @@ static const struct seq_operations prism2_scan_results_proc_seqops = { | |||
423 | .stop = prism2_scan_results_proc_stop, | 349 | .stop = prism2_scan_results_proc_stop, |
424 | .show = prism2_scan_results_proc_show, | 350 | .show = prism2_scan_results_proc_show, |
425 | }; | 351 | }; |
426 | |||
427 | static int prism2_scan_results_proc_open(struct inode *inode, struct file *file) | ||
428 | { | ||
429 | int ret = seq_open(file, &prism2_scan_results_proc_seqops); | ||
430 | if (ret == 0) { | ||
431 | struct seq_file *m = file->private_data; | ||
432 | m->private = PDE_DATA(inode); | ||
433 | } | ||
434 | return ret; | ||
435 | } | ||
436 | |||
437 | static const struct file_operations prism2_scan_results_proc_fops = { | ||
438 | .open = prism2_scan_results_proc_open, | ||
439 | .read = seq_read, | ||
440 | .llseek = seq_lseek, | ||
441 | .release = seq_release, | ||
442 | }; | ||
443 | |||
444 | |||
445 | #endif /* PRISM2_NO_STATION_MODES */ | 352 | #endif /* PRISM2_NO_STATION_MODES */ |
446 | 353 | ||
447 | 354 | ||
@@ -463,29 +370,29 @@ void hostap_init_proc(local_info_t *local) | |||
463 | } | 370 | } |
464 | 371 | ||
465 | #ifndef PRISM2_NO_PROCFS_DEBUG | 372 | #ifndef PRISM2_NO_PROCFS_DEBUG |
466 | proc_create_data("debug", 0, local->proc, | 373 | proc_create_single_data("debug", 0, local->proc, |
467 | &prism2_debug_proc_fops, local); | 374 | prism2_debug_proc_show, local); |
468 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 375 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
469 | proc_create_data("stats", 0, local->proc, | 376 | proc_create_single_data("stats", 0, local->proc, prism2_stats_proc_show, |
470 | &prism2_stats_proc_fops, local); | 377 | local); |
471 | proc_create_data("wds", 0, local->proc, | 378 | proc_create_seq_data("wds", 0, local->proc, |
472 | &prism2_wds_proc_fops, local); | 379 | &prism2_wds_proc_seqops, local); |
473 | proc_create_data("pda", 0, local->proc, | 380 | proc_create_data("pda", 0, local->proc, |
474 | &prism2_pda_proc_fops, local); | 381 | &prism2_pda_proc_fops, local); |
475 | proc_create_data("aux_dump", 0, local->proc, | 382 | proc_create_data("aux_dump", 0, local->proc, |
476 | local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, | 383 | local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, |
477 | local); | 384 | local); |
478 | proc_create_data("bss_list", 0, local->proc, | 385 | proc_create_seq_data("bss_list", 0, local->proc, |
479 | &prism2_bss_list_proc_fops, local); | 386 | &prism2_bss_list_proc_seqops, local); |
480 | proc_create_data("crypt", 0, local->proc, | 387 | proc_create_single_data("crypt", 0, local->proc, prism2_crypt_proc_show, |
481 | &prism2_crypt_proc_fops, local); | 388 | local); |
482 | #ifdef PRISM2_IO_DEBUG | 389 | #ifdef PRISM2_IO_DEBUG |
483 | proc_create_data("io_debug", 0, local->proc, | 390 | proc_create_single_data("io_debug", 0, local->proc, |
484 | &prism2_io_debug_proc_fops, local); | 391 | prism2_debug_proc_show, local); |
485 | #endif /* PRISM2_IO_DEBUG */ | 392 | #endif /* PRISM2_IO_DEBUG */ |
486 | #ifndef PRISM2_NO_STATION_MODES | 393 | #ifndef PRISM2_NO_STATION_MODES |
487 | proc_create_data("scan_results", 0, local->proc, | 394 | proc_create_seq_data("scan_results", 0, local->proc, |
488 | &prism2_scan_results_proc_fops, local); | 395 | &prism2_scan_results_proc_seqops, local); |
489 | #endif /* PRISM2_NO_STATION_MODES */ | 396 | #endif /* PRISM2_NO_STATION_MODES */ |
490 | } | 397 | } |
491 | 398 | ||