1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include <linux/debugfs.h>
24#include <linux/wimax.h>
25#include "wimax-internal.h"
26
27#define D_SUBMODULE debugfs
28#include "debug-levels.h"
29
30
31#define __debugfs_register(prefix, name, parent) \
32do { \
33 result = d_level_register_debugfs(prefix, name, parent); \
34 if (result < 0) \
35 goto error; \
36} while (0)
37
38
39int wimax_debugfs_add(struct wimax_dev *wimax_dev)
40{
41 int result;
42 struct net_device *net_dev = wimax_dev->net_dev;
43 struct device *dev = net_dev->dev.parent;
44 struct dentry *dentry;
45 char buf[128];
46
47 snprintf(buf, sizeof(buf), "wimax:%s", net_dev->name);
48 dentry = debugfs_create_dir(buf, NULL);
49 result = PTR_ERR(dentry);
50 if (IS_ERR(dentry)) {
51 if (result == -ENODEV)
52 result = 0;
53 else
54 dev_err(dev, "Can't create debugfs dentry: %d\n",
55 result);
56 goto out;
57 }
58 wimax_dev->debugfs_dentry = dentry;
59 __debugfs_register("wimax_dl_", debugfs, dentry);
60 __debugfs_register("wimax_dl_", id_table, dentry);
61 __debugfs_register("wimax_dl_", op_msg, dentry);
62 __debugfs_register("wimax_dl_", op_reset, dentry);
63 __debugfs_register("wimax_dl_", op_rfkill, dentry);
64 __debugfs_register("wimax_dl_", op_state_get, dentry);
65 __debugfs_register("wimax_dl_", stack, dentry);
66 result = 0;
67out:
68 return result;
69
70error:
71 debugfs_remove_recursive(wimax_dev->debugfs_dentry);
72 return result;
73}
74
75void wimax_debugfs_rm(struct wimax_dev *wimax_dev)
76{
77 debugfs_remove_recursive(wimax_dev->debugfs_dentry);
78}
79
80
81