Alexander Aring | b1815fd | 2015-12-09 22:46:30 +0100 | [diff] [blame] | 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 | |
| 19 | static struct dentry *lowpan_debugfs; |
| 20 | |
| 21 | int 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 | |
| 32 | fail: |
| 33 | return -EINVAL; |
| 34 | } |
| 35 | |
| 36 | void lowpan_dev_debugfs_exit(struct net_device *dev) |
| 37 | { |
| 38 | debugfs_remove_recursive(lowpan_priv(dev)->iface_debugfs); |
| 39 | } |
| 40 | |
| 41 | int __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 | |
| 50 | void lowpan_debugfs_exit(void) |
| 51 | { |
| 52 | debugfs_remove_recursive(lowpan_debugfs); |
| 53 | } |