]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - net/6lowpan/debugfs.c
6lowpan: add debugfs support
[mirror_ubuntu-hirsute-kernel.git] / net / 6lowpan / debugfs.c
CommitLineData
b1815fd9
AA
1/* This program is free software; you can redistribute it and/or modify
2 * it under the terms of the GNU General Public License version 2
3 * as published by the Free Software Foundation.
4 *
5 * This program is distributed in the hope that it will be useful,
6 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 * GNU General Public License for more details.
9 *
10 * Authors:
11 * (C) 2015 Pengutronix, Alexander Aring <aar@pengutronix.de>
12 * Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
13 */
14
15#include <net/6lowpan.h>
16
17#include "6lowpan_i.h"
18
19static struct dentry *lowpan_debugfs;
20
21int lowpan_dev_debugfs_init(struct net_device *dev)
22{
23 struct lowpan_priv *lpriv = lowpan_priv(dev);
24
25 /* creating the root */
26 lpriv->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs);
27 if (!lpriv->iface_debugfs)
28 goto fail;
29
30 return 0;
31
32fail:
33 return -EINVAL;
34}
35
36void lowpan_dev_debugfs_exit(struct net_device *dev)
37{
38 debugfs_remove_recursive(lowpan_priv(dev)->iface_debugfs);
39}
40
41int __init lowpan_debugfs_init(void)
42{
43 lowpan_debugfs = debugfs_create_dir("6lowpan", NULL);
44 if (!lowpan_debugfs)
45 return -EINVAL;
46
47 return 0;
48}
49
50void lowpan_debugfs_exit(void)
51{
52 debugfs_remove_recursive(lowpan_debugfs);
53}