aboutsummaryrefslogtreecommitdiffstats
path: root/net/wimax/debugfs.c
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2008-12-20 19:57:40 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-07 13:00:17 -0500
commit617209ccf73b571953cf4c76519c65a5e52d15fd (patch)
treef4f29427b55782b5e76d0f37eaac26b004db695a /net/wimax/debugfs.c
parent3e65646bb12be03b14dff53907391095a52d5f49 (diff)
wimax: debugfs controls
Expose knobs to control the stack's debug output. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net/wimax/debugfs.c')
-rw-r--r--net/wimax/debugfs.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/net/wimax/debugfs.c b/net/wimax/debugfs.c
new file mode 100644
index 000000000000..87cf4430079c
--- /dev/null
+++ b/net/wimax/debugfs.c
@@ -0,0 +1,90 @@
1/*
2 * Linux WiMAX
3 * Debugfs support
4 *
5 *
6 * Copyright (C) 2005-2006 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
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/* Debug framework control of debug levels */
32struct d_level D_LEVEL[] = {
33 D_SUBMODULE_DEFINE(debugfs),
34 D_SUBMODULE_DEFINE(id_table),
35 D_SUBMODULE_DEFINE(op_msg),
36 D_SUBMODULE_DEFINE(op_reset),
37 D_SUBMODULE_DEFINE(op_rfkill),
38 D_SUBMODULE_DEFINE(stack),
39};
40size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
41
42#define __debugfs_register(prefix, name, parent) \
43do { \
44 result = d_level_register_debugfs(prefix, name, parent); \
45 if (result < 0) \
46 goto error; \
47} while (0)
48
49
50int wimax_debugfs_add(struct wimax_dev *wimax_dev)
51{
52 int result;
53 struct net_device *net_dev = wimax_dev->net_dev;
54 struct device *dev = net_dev->dev.parent;
55 struct dentry *dentry;
56 char buf[128];
57
58 snprintf(buf, sizeof(buf), "wimax:%s", net_dev->name);
59 dentry = debugfs_create_dir(buf, NULL);
60 result = PTR_ERR(dentry);
61 if (IS_ERR(dentry)) {
62 if (result == -ENODEV)
63 result = 0; /* No debugfs support */
64 else
65 dev_err(dev, "Can't create debugfs dentry: %d\n",
66 result);
67 goto out;
68 }
69 wimax_dev->debugfs_dentry = dentry;
70 __debugfs_register("wimax_dl_", debugfs, dentry);
71 __debugfs_register("wimax_dl_", id_table, dentry);
72 __debugfs_register("wimax_dl_", op_msg, dentry);
73 __debugfs_register("wimax_dl_", op_reset, dentry);
74 __debugfs_register("wimax_dl_", op_rfkill, dentry);
75 __debugfs_register("wimax_dl_", stack, dentry);
76 result = 0;
77out:
78 return result;
79
80error:
81 debugfs_remove_recursive(wimax_dev->debugfs_dentry);
82 return result;
83}
84
85void wimax_debugfs_rm(struct wimax_dev *wimax_dev)
86{
87 debugfs_remove_recursive(wimax_dev->debugfs_dentry);
88}
89
90