xref: /linux/drivers/net/wireless/broadcom/b43legacy/debugfs.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef B43legacy_DEBUGFS_H_
3 #define B43legacy_DEBUGFS_H_
4 
5 struct b43legacy_wldev;
6 struct b43legacy_txstatus;
7 
8 enum b43legacy_dyndbg { /* Dynamic debugging features */
9 	B43legacy_DBG_XMITPOWER,
10 	B43legacy_DBG_DMAOVERFLOW,
11 	B43legacy_DBG_DMAVERBOSE,
12 	B43legacy_DBG_PWORK_FAST,
13 	B43legacy_DBG_PWORK_STOP,
14 	__B43legacy_NR_DYNDBG,
15 };
16 
17 
18 #ifdef CONFIG_B43LEGACY_DEBUG
19 
20 struct dentry;
21 
22 #define B43legacy_NR_LOGGED_TXSTATUS	100
23 
24 struct b43legacy_txstatus_log {
25 	struct b43legacy_txstatus *log;
26 	int end;
27 	spinlock_t lock;	/* lock for debugging */
28 };
29 
30 struct b43legacy_dfs_file {
31 	char *buffer;
32 	size_t data_len;
33 };
34 
35 struct b43legacy_dfsentry {
36 	struct b43legacy_wldev *dev;
37 	struct dentry *subdir;
38 
39 	struct b43legacy_dfs_file file_tsf;
40 	struct b43legacy_dfs_file file_ucode_regs;
41 	struct b43legacy_dfs_file file_shm;
42 	struct b43legacy_dfs_file file_txstat;
43 	struct b43legacy_dfs_file file_txpower_g;
44 	struct b43legacy_dfs_file file_restart;
45 	struct b43legacy_dfs_file file_loctls;
46 
47 	struct b43legacy_txstatus_log txstatlog;
48 
49 	/* Enabled/Disabled list for the dynamic debugging features. */
50 	bool dyn_debug[__B43legacy_NR_DYNDBG];
51 };
52 
53 int b43legacy_debug(struct b43legacy_wldev *dev,
54 		    enum b43legacy_dyndbg feature);
55 
56 void b43legacy_debugfs_init(void);
57 void b43legacy_debugfs_exit(void);
58 void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev);
59 void b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev);
60 void b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev,
61 				  const struct b43legacy_txstatus *status);
62 
63 #else /* CONFIG_B43LEGACY_DEBUG*/
64 
65 static inline
b43legacy_debug(struct b43legacy_wldev * dev,enum b43legacy_dyndbg feature)66 int b43legacy_debug(struct b43legacy_wldev *dev,
67 		    enum b43legacy_dyndbg feature)
68 {
69 	return 0;
70 }
71 
72 static inline
b43legacy_debugfs_init(void)73 void b43legacy_debugfs_init(void) { }
74 static inline
b43legacy_debugfs_exit(void)75 void b43legacy_debugfs_exit(void) { }
76 static inline
b43legacy_debugfs_add_device(struct b43legacy_wldev * dev)77 void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev) { }
78 static inline
b43legacy_debugfs_remove_device(struct b43legacy_wldev * dev)79 void b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev) { }
80 static inline
b43legacy_debugfs_log_txstat(struct b43legacy_wldev * dev,const struct b43legacy_txstatus * status)81 void b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev,
82 				  const struct b43legacy_txstatus *status)
83 				  { }
84 
85 #endif /* CONFIG_B43LEGACY_DEBUG*/
86 
87 #endif /* B43legacy_DEBUGFS_H_ */
88