dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / net / wireless / ralink / rt2x00 / rt2x00debug.c
blob05a2e8da412c847075cb5adda1f7f568c537c7f7
1 /*
2 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
3 <http://rt2x00.serialmonkey.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 Module: rt2x00lib
21 Abstract: rt2x00 debugfs specific routines.
24 #include <linux/debugfs.h>
25 #include <linux/kernel.h>
26 #include <linux/module.h>
27 #include <linux/poll.h>
28 #include <linux/sched.h>
29 #include <linux/slab.h>
30 #include <linux/uaccess.h>
32 #include "rt2x00.h"
33 #include "rt2x00lib.h"
34 #include "rt2x00dump.h"
36 #define MAX_LINE_LENGTH 64
38 struct rt2x00debug_crypto {
39 unsigned long success;
40 unsigned long icv_error;
41 unsigned long mic_error;
42 unsigned long key_error;
45 struct rt2x00debug_intf {
47 * Pointer to driver structure where
48 * this debugfs entry belongs to.
50 struct rt2x00_dev *rt2x00dev;
53 * Reference to the rt2x00debug structure
54 * which can be used to communicate with
55 * the registers.
57 const struct rt2x00debug *debug;
60 * Debugfs entries for:
61 * - driver folder
62 * - driver file
63 * - chipset file
64 * - device state flags file
65 * - device capability flags file
66 * - register folder
67 * - csr offset/value files
68 * - eeprom offset/value files
69 * - bbp offset/value files
70 * - rf offset/value files
71 * - rfcsr offset/value files
72 * - queue folder
73 * - frame dump file
74 * - queue stats file
75 * - crypto stats file
77 struct dentry *driver_folder;
78 struct dentry *driver_entry;
79 struct dentry *chipset_entry;
80 struct dentry *dev_flags;
81 struct dentry *cap_flags;
82 struct dentry *register_folder;
83 struct dentry *csr_off_entry;
84 struct dentry *csr_val_entry;
85 struct dentry *eeprom_off_entry;
86 struct dentry *eeprom_val_entry;
87 struct dentry *bbp_off_entry;
88 struct dentry *bbp_val_entry;
89 struct dentry *rf_off_entry;
90 struct dentry *rf_val_entry;
91 struct dentry *rfcsr_off_entry;
92 struct dentry *rfcsr_val_entry;
93 struct dentry *queue_folder;
94 struct dentry *queue_frame_dump_entry;
95 struct dentry *queue_stats_entry;
96 struct dentry *crypto_stats_entry;
99 * The frame dump file only allows a single reader,
100 * so we need to store the current state here.
102 unsigned long frame_dump_flags;
103 #define FRAME_DUMP_FILE_OPEN 1
106 * We queue each frame before dumping it to the user,
107 * per read command we will pass a single skb structure
108 * so we should be prepared to queue multiple sk buffers
109 * before sending it to userspace.
111 struct sk_buff_head frame_dump_skbqueue;
112 wait_queue_head_t frame_dump_waitqueue;
115 * HW crypto statistics.
116 * All statistics are stored separately per cipher type.
118 struct rt2x00debug_crypto crypto_stats[CIPHER_MAX];
121 * Driver and chipset files will use a data buffer
122 * that has been created in advance. This will simplify
123 * the code since we can use the debugfs functions.
125 struct debugfs_blob_wrapper driver_blob;
126 struct debugfs_blob_wrapper chipset_blob;
129 * Requested offset for each register type.
131 unsigned int offset_csr;
132 unsigned int offset_eeprom;
133 unsigned int offset_bbp;
134 unsigned int offset_rf;
135 unsigned int offset_rfcsr;
138 void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
139 struct rxdone_entry_desc *rxdesc)
141 struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf;
142 enum cipher cipher = rxdesc->cipher;
143 enum rx_crypto status = rxdesc->cipher_status;
145 if (cipher == CIPHER_TKIP_NO_MIC)
146 cipher = CIPHER_TKIP;
147 if (cipher == CIPHER_NONE || cipher >= CIPHER_MAX)
148 return;
150 /* Remove CIPHER_NONE index */
151 cipher--;
153 intf->crypto_stats[cipher].success += (status == RX_CRYPTO_SUCCESS);
154 intf->crypto_stats[cipher].icv_error += (status == RX_CRYPTO_FAIL_ICV);
155 intf->crypto_stats[cipher].mic_error += (status == RX_CRYPTO_FAIL_MIC);
156 intf->crypto_stats[cipher].key_error += (status == RX_CRYPTO_FAIL_KEY);
159 void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
160 enum rt2x00_dump_type type, struct queue_entry *entry)
162 struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf;
163 struct sk_buff *skb = entry->skb;
164 struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
165 struct sk_buff *skbcopy;
166 struct rt2x00dump_hdr *dump_hdr;
167 struct timespec64 timestamp;
168 u32 data_len;
170 if (likely(!test_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags)))
171 return;
173 ktime_get_ts64(&timestamp);
175 if (skb_queue_len(&intf->frame_dump_skbqueue) > 20) {
176 rt2x00_dbg(rt2x00dev, "txrx dump queue length exceeded\n");
177 return;
180 data_len = skb->len;
181 if (skbdesc->flags & SKBDESC_DESC_IN_SKB)
182 data_len -= skbdesc->desc_len;
184 skbcopy = alloc_skb(sizeof(*dump_hdr) + skbdesc->desc_len + data_len,
185 GFP_ATOMIC);
186 if (!skbcopy) {
187 rt2x00_dbg(rt2x00dev, "Failed to copy skb for dump\n");
188 return;
191 dump_hdr = skb_put(skbcopy, sizeof(*dump_hdr));
192 dump_hdr->version = cpu_to_le32(DUMP_HEADER_VERSION);
193 dump_hdr->header_length = cpu_to_le32(sizeof(*dump_hdr));
194 dump_hdr->desc_length = cpu_to_le32(skbdesc->desc_len);
195 dump_hdr->data_length = cpu_to_le32(data_len);
196 dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt);
197 dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf);
198 dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev);
199 dump_hdr->type = cpu_to_le16(type);
200 dump_hdr->queue_index = entry->queue->qid;
201 dump_hdr->entry_index = entry->entry_idx;
202 dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec);
203 dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_nsec /
204 NSEC_PER_USEC);
206 if (!(skbdesc->flags & SKBDESC_DESC_IN_SKB))
207 skb_put_data(skbcopy, skbdesc->desc, skbdesc->desc_len);
208 skb_put_data(skbcopy, skb->data, skb->len);
210 skb_queue_tail(&intf->frame_dump_skbqueue, skbcopy);
211 wake_up_interruptible(&intf->frame_dump_waitqueue);
214 * Verify that the file has not been closed while we were working.
216 if (!test_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags))
217 skb_queue_purge(&intf->frame_dump_skbqueue);
219 EXPORT_SYMBOL_GPL(rt2x00debug_dump_frame);
221 static int rt2x00debug_file_open(struct inode *inode, struct file *file)
223 struct rt2x00debug_intf *intf = inode->i_private;
225 file->private_data = inode->i_private;
227 if (!try_module_get(intf->debug->owner))
228 return -EBUSY;
230 return 0;
233 static int rt2x00debug_file_release(struct inode *inode, struct file *file)
235 struct rt2x00debug_intf *intf = file->private_data;
237 module_put(intf->debug->owner);
239 return 0;
242 static int rt2x00debug_open_queue_dump(struct inode *inode, struct file *file)
244 struct rt2x00debug_intf *intf = inode->i_private;
245 int retval;
247 retval = rt2x00debug_file_open(inode, file);
248 if (retval)
249 return retval;
251 if (test_and_set_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags)) {
252 rt2x00debug_file_release(inode, file);
253 return -EBUSY;
256 return 0;
259 static int rt2x00debug_release_queue_dump(struct inode *inode, struct file *file)
261 struct rt2x00debug_intf *intf = inode->i_private;
263 skb_queue_purge(&intf->frame_dump_skbqueue);
265 clear_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags);
267 return rt2x00debug_file_release(inode, file);
270 static ssize_t rt2x00debug_read_queue_dump(struct file *file,
271 char __user *buf,
272 size_t length,
273 loff_t *offset)
275 struct rt2x00debug_intf *intf = file->private_data;
276 struct sk_buff *skb;
277 size_t status;
278 int retval;
280 if (file->f_flags & O_NONBLOCK)
281 return -EAGAIN;
283 retval =
284 wait_event_interruptible(intf->frame_dump_waitqueue,
285 (skb =
286 skb_dequeue(&intf->frame_dump_skbqueue)));
287 if (retval)
288 return retval;
290 status = min_t(size_t, skb->len, length);
291 if (copy_to_user(buf, skb->data, status)) {
292 status = -EFAULT;
293 goto exit;
296 *offset += status;
298 exit:
299 kfree_skb(skb);
301 return status;
304 static __poll_t rt2x00debug_poll_queue_dump(struct file *file,
305 poll_table *wait)
307 struct rt2x00debug_intf *intf = file->private_data;
309 poll_wait(file, &intf->frame_dump_waitqueue, wait);
311 if (!skb_queue_empty(&intf->frame_dump_skbqueue))
312 return EPOLLOUT | EPOLLWRNORM;
314 return 0;
317 static const struct file_operations rt2x00debug_fop_queue_dump = {
318 .owner = THIS_MODULE,
319 .read = rt2x00debug_read_queue_dump,
320 .poll = rt2x00debug_poll_queue_dump,
321 .open = rt2x00debug_open_queue_dump,
322 .release = rt2x00debug_release_queue_dump,
323 .llseek = default_llseek,
326 static ssize_t rt2x00debug_read_queue_stats(struct file *file,
327 char __user *buf,
328 size_t length,
329 loff_t *offset)
331 struct rt2x00debug_intf *intf = file->private_data;
332 struct data_queue *queue;
333 unsigned long irqflags;
334 unsigned int lines = 1 + intf->rt2x00dev->data_queues;
335 size_t size;
336 char *data;
337 char *temp;
339 if (*offset)
340 return 0;
342 data = kcalloc(lines, MAX_LINE_LENGTH, GFP_KERNEL);
343 if (!data)
344 return -ENOMEM;
346 temp = data +
347 sprintf(data, "qid\tflags\t\tcount\tlimit\tlength\tindex\tdma done\tdone\n");
349 queue_for_each(intf->rt2x00dev, queue) {
350 spin_lock_irqsave(&queue->index_lock, irqflags);
352 temp += sprintf(temp, "%d\t0x%.8x\t%d\t%d\t%d\t%d\t%d\t\t%d\n",
353 queue->qid, (unsigned int)queue->flags,
354 queue->count, queue->limit, queue->length,
355 queue->index[Q_INDEX],
356 queue->index[Q_INDEX_DMA_DONE],
357 queue->index[Q_INDEX_DONE]);
359 spin_unlock_irqrestore(&queue->index_lock, irqflags);
362 size = strlen(data);
363 size = min(size, length);
365 if (copy_to_user(buf, data, size)) {
366 kfree(data);
367 return -EFAULT;
370 kfree(data);
372 *offset += size;
373 return size;
376 static const struct file_operations rt2x00debug_fop_queue_stats = {
377 .owner = THIS_MODULE,
378 .read = rt2x00debug_read_queue_stats,
379 .open = rt2x00debug_file_open,
380 .release = rt2x00debug_file_release,
381 .llseek = default_llseek,
384 #ifdef CONFIG_RT2X00_LIB_CRYPTO
385 static ssize_t rt2x00debug_read_crypto_stats(struct file *file,
386 char __user *buf,
387 size_t length,
388 loff_t *offset)
390 struct rt2x00debug_intf *intf = file->private_data;
391 static const char * const name[] = { "WEP64", "WEP128", "TKIP", "AES" };
392 char *data;
393 char *temp;
394 size_t size;
395 unsigned int i;
397 if (*offset)
398 return 0;
400 data = kcalloc(1 + CIPHER_MAX, MAX_LINE_LENGTH, GFP_KERNEL);
401 if (!data)
402 return -ENOMEM;
404 temp = data;
405 temp += sprintf(data, "cipher\tsuccess\ticv err\tmic err\tkey err\n");
407 for (i = 0; i < CIPHER_MAX; i++) {
408 temp += sprintf(temp, "%s\t%lu\t%lu\t%lu\t%lu\n", name[i],
409 intf->crypto_stats[i].success,
410 intf->crypto_stats[i].icv_error,
411 intf->crypto_stats[i].mic_error,
412 intf->crypto_stats[i].key_error);
415 size = strlen(data);
416 size = min(size, length);
418 if (copy_to_user(buf, data, size)) {
419 kfree(data);
420 return -EFAULT;
423 kfree(data);
425 *offset += size;
426 return size;
429 static const struct file_operations rt2x00debug_fop_crypto_stats = {
430 .owner = THIS_MODULE,
431 .read = rt2x00debug_read_crypto_stats,
432 .open = rt2x00debug_file_open,
433 .release = rt2x00debug_file_release,
434 .llseek = default_llseek,
436 #endif
438 #define RT2X00DEBUGFS_OPS_READ(__name, __format, __type) \
439 static ssize_t rt2x00debug_read_##__name(struct file *file, \
440 char __user *buf, \
441 size_t length, \
442 loff_t *offset) \
444 struct rt2x00debug_intf *intf = file->private_data; \
445 const struct rt2x00debug *debug = intf->debug; \
446 char line[16]; \
447 size_t size; \
448 unsigned int index = intf->offset_##__name; \
449 __type value; \
451 if (*offset) \
452 return 0; \
454 if (index >= debug->__name.word_count) \
455 return -EINVAL; \
457 index += (debug->__name.word_base / \
458 debug->__name.word_size); \
460 if (debug->__name.flags & RT2X00DEBUGFS_OFFSET) \
461 index *= debug->__name.word_size; \
463 value = debug->__name.read(intf->rt2x00dev, index); \
465 size = sprintf(line, __format, value); \
467 return simple_read_from_buffer(buf, length, offset, line, size); \
470 #define RT2X00DEBUGFS_OPS_WRITE(__name, __type) \
471 static ssize_t rt2x00debug_write_##__name(struct file *file, \
472 const char __user *buf,\
473 size_t length, \
474 loff_t *offset) \
476 struct rt2x00debug_intf *intf = file->private_data; \
477 const struct rt2x00debug *debug = intf->debug; \
478 char line[17]; \
479 size_t size; \
480 unsigned int index = intf->offset_##__name; \
481 __type value; \
483 if (*offset) \
484 return 0; \
486 if (index >= debug->__name.word_count) \
487 return -EINVAL; \
489 if (length > sizeof(line)) \
490 return -EINVAL; \
492 if (copy_from_user(line, buf, length)) \
493 return -EFAULT; \
494 line[16] = 0; \
496 size = strlen(line); \
497 value = simple_strtoul(line, NULL, 0); \
499 index += (debug->__name.word_base / \
500 debug->__name.word_size); \
502 if (debug->__name.flags & RT2X00DEBUGFS_OFFSET) \
503 index *= debug->__name.word_size; \
505 debug->__name.write(intf->rt2x00dev, index, value); \
507 *offset += size; \
508 return size; \
511 #define RT2X00DEBUGFS_OPS(__name, __format, __type) \
512 RT2X00DEBUGFS_OPS_READ(__name, __format, __type); \
513 RT2X00DEBUGFS_OPS_WRITE(__name, __type); \
515 static const struct file_operations rt2x00debug_fop_##__name = {\
516 .owner = THIS_MODULE, \
517 .read = rt2x00debug_read_##__name, \
518 .write = rt2x00debug_write_##__name, \
519 .open = rt2x00debug_file_open, \
520 .release = rt2x00debug_file_release, \
521 .llseek = generic_file_llseek, \
524 RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32);
525 RT2X00DEBUGFS_OPS(eeprom, "0x%.4x\n", u16);
526 RT2X00DEBUGFS_OPS(bbp, "0x%.2x\n", u8);
527 RT2X00DEBUGFS_OPS(rf, "0x%.8x\n", u32);
528 RT2X00DEBUGFS_OPS(rfcsr, "0x%.2x\n", u8);
530 static ssize_t rt2x00debug_read_dev_flags(struct file *file,
531 char __user *buf,
532 size_t length,
533 loff_t *offset)
535 struct rt2x00debug_intf *intf = file->private_data;
536 char line[16];
537 size_t size;
539 if (*offset)
540 return 0;
542 size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->flags);
544 return simple_read_from_buffer(buf, length, offset, line, size);
547 static const struct file_operations rt2x00debug_fop_dev_flags = {
548 .owner = THIS_MODULE,
549 .read = rt2x00debug_read_dev_flags,
550 .open = rt2x00debug_file_open,
551 .release = rt2x00debug_file_release,
552 .llseek = default_llseek,
555 static ssize_t rt2x00debug_read_cap_flags(struct file *file,
556 char __user *buf,
557 size_t length,
558 loff_t *offset)
560 struct rt2x00debug_intf *intf = file->private_data;
561 char line[16];
562 size_t size;
564 if (*offset)
565 return 0;
567 size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->cap_flags);
569 return simple_read_from_buffer(buf, length, offset, line, size);
572 static const struct file_operations rt2x00debug_fop_cap_flags = {
573 .owner = THIS_MODULE,
574 .read = rt2x00debug_read_cap_flags,
575 .open = rt2x00debug_file_open,
576 .release = rt2x00debug_file_release,
577 .llseek = default_llseek,
580 static struct dentry *rt2x00debug_create_file_driver(const char *name,
581 struct rt2x00debug_intf
582 *intf,
583 struct debugfs_blob_wrapper
584 *blob)
586 char *data;
588 data = kzalloc(3 * MAX_LINE_LENGTH, GFP_KERNEL);
589 if (!data)
590 return NULL;
592 blob->data = data;
593 data += sprintf(data, "driver:\t%s\n", intf->rt2x00dev->ops->name);
594 data += sprintf(data, "version:\t%s\n", DRV_VERSION);
595 blob->size = strlen(blob->data);
597 return debugfs_create_blob(name, 0400, intf->driver_folder, blob);
600 static struct dentry *rt2x00debug_create_file_chipset(const char *name,
601 struct rt2x00debug_intf
602 *intf,
603 struct
604 debugfs_blob_wrapper
605 *blob)
607 const struct rt2x00debug *debug = intf->debug;
608 char *data;
610 data = kzalloc(9 * MAX_LINE_LENGTH, GFP_KERNEL);
611 if (!data)
612 return NULL;
614 blob->data = data;
615 data += sprintf(data, "rt chip:\t%04x\n", intf->rt2x00dev->chip.rt);
616 data += sprintf(data, "rf chip:\t%04x\n", intf->rt2x00dev->chip.rf);
617 data += sprintf(data, "revision:\t%04x\n", intf->rt2x00dev->chip.rev);
618 data += sprintf(data, "\n");
619 data += sprintf(data, "register\tbase\twords\twordsize\n");
620 #define RT2X00DEBUGFS_SPRINTF_REGISTER(__name) \
622 if (debug->__name.read) \
623 data += sprintf(data, __stringify(__name) \
624 "\t%d\t%d\t%d\n", \
625 debug->__name.word_base, \
626 debug->__name.word_count, \
627 debug->__name.word_size); \
629 RT2X00DEBUGFS_SPRINTF_REGISTER(csr);
630 RT2X00DEBUGFS_SPRINTF_REGISTER(eeprom);
631 RT2X00DEBUGFS_SPRINTF_REGISTER(bbp);
632 RT2X00DEBUGFS_SPRINTF_REGISTER(rf);
633 RT2X00DEBUGFS_SPRINTF_REGISTER(rfcsr);
634 #undef RT2X00DEBUGFS_SPRINTF_REGISTER
636 blob->size = strlen(blob->data);
638 return debugfs_create_blob(name, 0400, intf->driver_folder, blob);
641 void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
643 const struct rt2x00debug *debug = rt2x00dev->ops->debugfs;
644 struct rt2x00debug_intf *intf;
646 intf = kzalloc(sizeof(struct rt2x00debug_intf), GFP_KERNEL);
647 if (!intf) {
648 rt2x00_err(rt2x00dev, "Failed to allocate debug handler\n");
649 return;
652 intf->debug = debug;
653 intf->rt2x00dev = rt2x00dev;
654 rt2x00dev->debugfs_intf = intf;
656 intf->driver_folder =
657 debugfs_create_dir(intf->rt2x00dev->ops->name,
658 rt2x00dev->hw->wiphy->debugfsdir);
660 intf->driver_entry =
661 rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob);
663 intf->chipset_entry =
664 rt2x00debug_create_file_chipset("chipset",
665 intf, &intf->chipset_blob);
667 intf->dev_flags = debugfs_create_file("dev_flags", 0400,
668 intf->driver_folder, intf,
669 &rt2x00debug_fop_dev_flags);
671 intf->cap_flags = debugfs_create_file("cap_flags", 0400,
672 intf->driver_folder, intf,
673 &rt2x00debug_fop_cap_flags);
675 intf->register_folder =
676 debugfs_create_dir("register", intf->driver_folder);
678 #define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \
679 ({ \
680 if (debug->__name.read) { \
681 (__intf)->__name##_off_entry = \
682 debugfs_create_u32(__stringify(__name) "_offset", \
683 0600, \
684 (__intf)->register_folder, \
685 &(__intf)->offset_##__name); \
687 (__intf)->__name##_val_entry = \
688 debugfs_create_file(__stringify(__name) "_value", \
689 0600, \
690 (__intf)->register_folder, \
691 (__intf), \
692 &rt2x00debug_fop_##__name); \
696 RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, csr);
697 RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, eeprom);
698 RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, bbp);
699 RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, rf);
700 RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, rfcsr);
702 #undef RT2X00DEBUGFS_CREATE_REGISTER_ENTRY
704 intf->queue_folder =
705 debugfs_create_dir("queue", intf->driver_folder);
707 intf->queue_frame_dump_entry =
708 debugfs_create_file("dump", 0400, intf->queue_folder,
709 intf, &rt2x00debug_fop_queue_dump);
711 skb_queue_head_init(&intf->frame_dump_skbqueue);
712 init_waitqueue_head(&intf->frame_dump_waitqueue);
714 intf->queue_stats_entry =
715 debugfs_create_file("queue", 0400, intf->queue_folder,
716 intf, &rt2x00debug_fop_queue_stats);
718 #ifdef CONFIG_RT2X00_LIB_CRYPTO
719 if (rt2x00_has_cap_hw_crypto(rt2x00dev))
720 intf->crypto_stats_entry =
721 debugfs_create_file("crypto", 0444, intf->queue_folder,
722 intf,
723 &rt2x00debug_fop_crypto_stats);
724 #endif
726 return;
729 void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
731 struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf;
733 if (unlikely(!intf))
734 return;
736 skb_queue_purge(&intf->frame_dump_skbqueue);
738 #ifdef CONFIG_RT2X00_LIB_CRYPTO
739 debugfs_remove(intf->crypto_stats_entry);
740 #endif
741 debugfs_remove(intf->queue_stats_entry);
742 debugfs_remove(intf->queue_frame_dump_entry);
743 debugfs_remove(intf->queue_folder);
744 debugfs_remove(intf->rfcsr_val_entry);
745 debugfs_remove(intf->rfcsr_off_entry);
746 debugfs_remove(intf->rf_val_entry);
747 debugfs_remove(intf->rf_off_entry);
748 debugfs_remove(intf->bbp_val_entry);
749 debugfs_remove(intf->bbp_off_entry);
750 debugfs_remove(intf->eeprom_val_entry);
751 debugfs_remove(intf->eeprom_off_entry);
752 debugfs_remove(intf->csr_val_entry);
753 debugfs_remove(intf->csr_off_entry);
754 debugfs_remove(intf->register_folder);
755 debugfs_remove(intf->dev_flags);
756 debugfs_remove(intf->cap_flags);
757 debugfs_remove(intf->chipset_entry);
758 debugfs_remove(intf->driver_entry);
759 debugfs_remove(intf->driver_folder);
760 kfree(intf->chipset_blob.data);
761 kfree(intf->driver_blob.data);
762 kfree(intf);
764 rt2x00dev->debugfs_intf = NULL;