kernel: use generic thread_info allocator on MIPS
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / drivers / net / ag71xx / ag71xx_debugfs.c
1 /*
2 * Atheros AR71xx built-in ethernet mac driver
3 *
4 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * Based on Atheros' AG7100 driver
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 */
13
14 #include <linux/debugfs.h>
15
16 #include "ag71xx.h"
17
18 static struct dentry *ag71xx_debugfs_root;
19
20 int ag71xx_debugfs_root_init(void)
21 {
22 if (ag71xx_debugfs_root)
23 return -EBUSY;
24
25 ag71xx_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
26 if (!ag71xx_debugfs_root)
27 return -ENOENT;
28
29 return 0;
30 }
31
32 void ag71xx_debugfs_root_exit(void)
33 {
34 debugfs_remove(ag71xx_debugfs_root);
35 ag71xx_debugfs_root = NULL;
36 }
37
38 void ag71xx_debugfs_exit(struct ag71xx *ag)
39 {
40 debugfs_remove(ag->debug.debugfs_dir);
41 }
42
43 int ag71xx_debugfs_init(struct ag71xx *ag)
44 {
45 ag->debug.debugfs_dir = debugfs_create_dir(ag->dev->name,
46 ag71xx_debugfs_root);
47 if (!ag->debug.debugfs_dir)
48 goto err;
49
50 return 0;
51
52 err:
53 ag71xx_debugfs_exit(ag);
54 return -ENOMEM;
55 }