diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/debugfs.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/debugfs.c | 181 |
1 files changed, 31 insertions, 150 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index dd71b7d2105c..402df14e091b 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -66,19 +66,10 @@ static const struct file_operations name## _ops = { \ | |||
66 | }; | 66 | }; |
67 | 67 | ||
68 | #define DEBUGFS_ADD(name, parent) \ | 68 | #define DEBUGFS_ADD(name, parent) \ |
69 | wl->debugfs.name = debugfs_create_file(#name, 0400, parent, \ | 69 | entry = debugfs_create_file(#name, 0400, parent, \ |
70 | wl, &name## _ops); \ | 70 | wl, &name## _ops); \ |
71 | if (IS_ERR(wl->debugfs.name)) { \ | 71 | if (!entry || IS_ERR(entry)) \ |
72 | ret = PTR_ERR(wl->debugfs.name); \ | 72 | goto err; \ |
73 | wl->debugfs.name = NULL; \ | ||
74 | goto out; \ | ||
75 | } | ||
76 | |||
77 | #define DEBUGFS_DEL(name) \ | ||
78 | do { \ | ||
79 | debugfs_remove(wl->debugfs.name); \ | ||
80 | wl->debugfs.name = NULL; \ | ||
81 | } while (0) | ||
82 | 73 | ||
83 | #define DEBUGFS_FWSTATS_FILE(sub, name, fmt) \ | 74 | #define DEBUGFS_FWSTATS_FILE(sub, name, fmt) \ |
84 | static ssize_t sub## _ ##name## _read(struct file *file, \ | 75 | static ssize_t sub## _ ##name## _read(struct file *file, \ |
@@ -100,10 +91,7 @@ static const struct file_operations sub## _ ##name## _ops = { \ | |||
100 | }; | 91 | }; |
101 | 92 | ||
102 | #define DEBUGFS_FWSTATS_ADD(sub, name) \ | 93 | #define DEBUGFS_FWSTATS_ADD(sub, name) \ |
103 | DEBUGFS_ADD(sub## _ ##name, wl->debugfs.fw_statistics) | 94 | DEBUGFS_ADD(sub## _ ##name, stats) |
104 | |||
105 | #define DEBUGFS_FWSTATS_DEL(sub, name) \ | ||
106 | DEBUGFS_DEL(sub## _ ##name) | ||
107 | 95 | ||
108 | static void wl1271_debugfs_update_stats(struct wl1271 *wl) | 96 | static void wl1271_debugfs_update_stats(struct wl1271 *wl) |
109 | { | 97 | { |
@@ -305,109 +293,16 @@ static const struct file_operations gpio_power_ops = { | |||
305 | .llseek = default_llseek, | 293 | .llseek = default_llseek, |
306 | }; | 294 | }; |
307 | 295 | ||
308 | static void wl1271_debugfs_delete_files(struct wl1271 *wl) | ||
309 | { | ||
310 | DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow); | ||
311 | |||
312 | DEBUGFS_FWSTATS_DEL(rx, out_of_mem); | ||
313 | DEBUGFS_FWSTATS_DEL(rx, hdr_overflow); | ||
314 | DEBUGFS_FWSTATS_DEL(rx, hw_stuck); | ||
315 | DEBUGFS_FWSTATS_DEL(rx, dropped); | ||
316 | DEBUGFS_FWSTATS_DEL(rx, fcs_err); | ||
317 | DEBUGFS_FWSTATS_DEL(rx, xfr_hint_trig); | ||
318 | DEBUGFS_FWSTATS_DEL(rx, path_reset); | ||
319 | DEBUGFS_FWSTATS_DEL(rx, reset_counter); | ||
320 | |||
321 | DEBUGFS_FWSTATS_DEL(dma, rx_requested); | ||
322 | DEBUGFS_FWSTATS_DEL(dma, rx_errors); | ||
323 | DEBUGFS_FWSTATS_DEL(dma, tx_requested); | ||
324 | DEBUGFS_FWSTATS_DEL(dma, tx_errors); | ||
325 | |||
326 | DEBUGFS_FWSTATS_DEL(isr, cmd_cmplt); | ||
327 | DEBUGFS_FWSTATS_DEL(isr, fiqs); | ||
328 | DEBUGFS_FWSTATS_DEL(isr, rx_headers); | ||
329 | DEBUGFS_FWSTATS_DEL(isr, rx_mem_overflow); | ||
330 | DEBUGFS_FWSTATS_DEL(isr, rx_rdys); | ||
331 | DEBUGFS_FWSTATS_DEL(isr, irqs); | ||
332 | DEBUGFS_FWSTATS_DEL(isr, tx_procs); | ||
333 | DEBUGFS_FWSTATS_DEL(isr, decrypt_done); | ||
334 | DEBUGFS_FWSTATS_DEL(isr, dma0_done); | ||
335 | DEBUGFS_FWSTATS_DEL(isr, dma1_done); | ||
336 | DEBUGFS_FWSTATS_DEL(isr, tx_exch_complete); | ||
337 | DEBUGFS_FWSTATS_DEL(isr, commands); | ||
338 | DEBUGFS_FWSTATS_DEL(isr, rx_procs); | ||
339 | DEBUGFS_FWSTATS_DEL(isr, hw_pm_mode_changes); | ||
340 | DEBUGFS_FWSTATS_DEL(isr, host_acknowledges); | ||
341 | DEBUGFS_FWSTATS_DEL(isr, pci_pm); | ||
342 | DEBUGFS_FWSTATS_DEL(isr, wakeups); | ||
343 | DEBUGFS_FWSTATS_DEL(isr, low_rssi); | ||
344 | |||
345 | DEBUGFS_FWSTATS_DEL(wep, addr_key_count); | ||
346 | DEBUGFS_FWSTATS_DEL(wep, default_key_count); | ||
347 | /* skipping wep.reserved */ | ||
348 | DEBUGFS_FWSTATS_DEL(wep, key_not_found); | ||
349 | DEBUGFS_FWSTATS_DEL(wep, decrypt_fail); | ||
350 | DEBUGFS_FWSTATS_DEL(wep, packets); | ||
351 | DEBUGFS_FWSTATS_DEL(wep, interrupt); | ||
352 | |||
353 | DEBUGFS_FWSTATS_DEL(pwr, ps_enter); | ||
354 | DEBUGFS_FWSTATS_DEL(pwr, elp_enter); | ||
355 | DEBUGFS_FWSTATS_DEL(pwr, missing_bcns); | ||
356 | DEBUGFS_FWSTATS_DEL(pwr, wake_on_host); | ||
357 | DEBUGFS_FWSTATS_DEL(pwr, wake_on_timer_exp); | ||
358 | DEBUGFS_FWSTATS_DEL(pwr, tx_with_ps); | ||
359 | DEBUGFS_FWSTATS_DEL(pwr, tx_without_ps); | ||
360 | DEBUGFS_FWSTATS_DEL(pwr, rcvd_beacons); | ||
361 | DEBUGFS_FWSTATS_DEL(pwr, power_save_off); | ||
362 | DEBUGFS_FWSTATS_DEL(pwr, enable_ps); | ||
363 | DEBUGFS_FWSTATS_DEL(pwr, disable_ps); | ||
364 | DEBUGFS_FWSTATS_DEL(pwr, fix_tsf_ps); | ||
365 | /* skipping cont_miss_bcns_spread for now */ | ||
366 | DEBUGFS_FWSTATS_DEL(pwr, rcvd_awake_beacons); | ||
367 | |||
368 | DEBUGFS_FWSTATS_DEL(mic, rx_pkts); | ||
369 | DEBUGFS_FWSTATS_DEL(mic, calc_failure); | ||
370 | |||
371 | DEBUGFS_FWSTATS_DEL(aes, encrypt_fail); | ||
372 | DEBUGFS_FWSTATS_DEL(aes, decrypt_fail); | ||
373 | DEBUGFS_FWSTATS_DEL(aes, encrypt_packets); | ||
374 | DEBUGFS_FWSTATS_DEL(aes, decrypt_packets); | ||
375 | DEBUGFS_FWSTATS_DEL(aes, encrypt_interrupt); | ||
376 | DEBUGFS_FWSTATS_DEL(aes, decrypt_interrupt); | ||
377 | |||
378 | DEBUGFS_FWSTATS_DEL(event, heart_beat); | ||
379 | DEBUGFS_FWSTATS_DEL(event, calibration); | ||
380 | DEBUGFS_FWSTATS_DEL(event, rx_mismatch); | ||
381 | DEBUGFS_FWSTATS_DEL(event, rx_mem_empty); | ||
382 | DEBUGFS_FWSTATS_DEL(event, rx_pool); | ||
383 | DEBUGFS_FWSTATS_DEL(event, oom_late); | ||
384 | DEBUGFS_FWSTATS_DEL(event, phy_transmit_error); | ||
385 | DEBUGFS_FWSTATS_DEL(event, tx_stuck); | ||
386 | |||
387 | DEBUGFS_FWSTATS_DEL(ps, pspoll_timeouts); | ||
388 | DEBUGFS_FWSTATS_DEL(ps, upsd_timeouts); | ||
389 | DEBUGFS_FWSTATS_DEL(ps, upsd_max_sptime); | ||
390 | DEBUGFS_FWSTATS_DEL(ps, upsd_max_apturn); | ||
391 | DEBUGFS_FWSTATS_DEL(ps, pspoll_max_apturn); | ||
392 | DEBUGFS_FWSTATS_DEL(ps, pspoll_utilization); | ||
393 | DEBUGFS_FWSTATS_DEL(ps, upsd_utilization); | ||
394 | |||
395 | DEBUGFS_FWSTATS_DEL(rxpipe, rx_prep_beacon_drop); | ||
396 | DEBUGFS_FWSTATS_DEL(rxpipe, descr_host_int_trig_rx_data); | ||
397 | DEBUGFS_FWSTATS_DEL(rxpipe, beacon_buffer_thres_host_int_trig_rx_data); | ||
398 | DEBUGFS_FWSTATS_DEL(rxpipe, missed_beacon_host_int_trig_rx_data); | ||
399 | DEBUGFS_FWSTATS_DEL(rxpipe, tx_xfr_host_int_trig_rx_data); | ||
400 | |||
401 | DEBUGFS_DEL(tx_queue_len); | ||
402 | DEBUGFS_DEL(retry_count); | ||
403 | DEBUGFS_DEL(excessive_retries); | ||
404 | |||
405 | DEBUGFS_DEL(gpio_power); | ||
406 | } | ||
407 | |||
408 | static int wl1271_debugfs_add_files(struct wl1271 *wl) | 296 | static int wl1271_debugfs_add_files(struct wl1271 *wl) |
409 | { | 297 | { |
410 | int ret = 0; | 298 | int ret = 0; |
299 | struct dentry *entry, *stats; | ||
300 | |||
301 | stats = debugfs_create_dir("fw-statistics", wl->rootdir); | ||
302 | if (!stats || IS_ERR(stats)) { | ||
303 | entry = stats; | ||
304 | goto err; | ||
305 | } | ||
411 | 306 | ||
412 | DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow); | 307 | DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow); |
413 | 308 | ||
@@ -500,15 +395,19 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl) | |||
500 | DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); | 395 | DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); |
501 | DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); | 396 | DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); |
502 | 397 | ||
503 | DEBUGFS_ADD(tx_queue_len, wl->debugfs.rootdir); | 398 | DEBUGFS_ADD(tx_queue_len, wl->rootdir); |
504 | DEBUGFS_ADD(retry_count, wl->debugfs.rootdir); | 399 | DEBUGFS_ADD(retry_count, wl->rootdir); |
505 | DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir); | 400 | DEBUGFS_ADD(excessive_retries, wl->rootdir); |
506 | 401 | ||
507 | DEBUGFS_ADD(gpio_power, wl->debugfs.rootdir); | 402 | DEBUGFS_ADD(gpio_power, wl->rootdir); |
508 | 403 | ||
509 | out: | 404 | return 0; |
510 | if (ret < 0) | 405 | |
511 | wl1271_debugfs_delete_files(wl); | 406 | err: |
407 | if (IS_ERR(entry)) | ||
408 | ret = PTR_ERR(entry); | ||
409 | else | ||
410 | ret = -ENOMEM; | ||
512 | 411 | ||
513 | return ret; | 412 | return ret; |
514 | } | 413 | } |
@@ -524,23 +423,14 @@ int wl1271_debugfs_init(struct wl1271 *wl) | |||
524 | { | 423 | { |
525 | int ret; | 424 | int ret; |
526 | 425 | ||
527 | wl->debugfs.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); | 426 | wl->rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); |
528 | 427 | ||
529 | if (IS_ERR(wl->debugfs.rootdir)) { | 428 | if (IS_ERR(wl->rootdir)) { |
530 | ret = PTR_ERR(wl->debugfs.rootdir); | 429 | ret = PTR_ERR(wl->rootdir); |
531 | wl->debugfs.rootdir = NULL; | 430 | wl->rootdir = NULL; |
532 | goto err; | 431 | goto err; |
533 | } | 432 | } |
534 | 433 | ||
535 | wl->debugfs.fw_statistics = debugfs_create_dir("fw-statistics", | ||
536 | wl->debugfs.rootdir); | ||
537 | |||
538 | if (IS_ERR(wl->debugfs.fw_statistics)) { | ||
539 | ret = PTR_ERR(wl->debugfs.fw_statistics); | ||
540 | wl->debugfs.fw_statistics = NULL; | ||
541 | goto err_root; | ||
542 | } | ||
543 | |||
544 | wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats), | 434 | wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats), |
545 | GFP_KERNEL); | 435 | GFP_KERNEL); |
546 | 436 | ||
@@ -563,12 +453,8 @@ err_file: | |||
563 | wl->stats.fw_stats = NULL; | 453 | wl->stats.fw_stats = NULL; |
564 | 454 | ||
565 | err_fw: | 455 | err_fw: |
566 | debugfs_remove(wl->debugfs.fw_statistics); | 456 | debugfs_remove_recursive(wl->rootdir); |
567 | wl->debugfs.fw_statistics = NULL; | 457 | wl->rootdir = NULL; |
568 | |||
569 | err_root: | ||
570 | debugfs_remove(wl->debugfs.rootdir); | ||
571 | wl->debugfs.rootdir = NULL; | ||
572 | 458 | ||
573 | err: | 459 | err: |
574 | return ret; | 460 | return ret; |
@@ -576,15 +462,10 @@ err: | |||
576 | 462 | ||
577 | void wl1271_debugfs_exit(struct wl1271 *wl) | 463 | void wl1271_debugfs_exit(struct wl1271 *wl) |
578 | { | 464 | { |
579 | wl1271_debugfs_delete_files(wl); | ||
580 | |||
581 | kfree(wl->stats.fw_stats); | 465 | kfree(wl->stats.fw_stats); |
582 | wl->stats.fw_stats = NULL; | 466 | wl->stats.fw_stats = NULL; |
583 | 467 | ||
584 | debugfs_remove(wl->debugfs.fw_statistics); | 468 | debugfs_remove_recursive(wl->rootdir); |
585 | wl->debugfs.fw_statistics = NULL; | 469 | wl->rootdir = NULL; |
586 | |||
587 | debugfs_remove(wl->debugfs.rootdir); | ||
588 | wl->debugfs.rootdir = NULL; | ||
589 | 470 | ||
590 | } | 471 | } |