debugfs.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #include <net/6lowpan.h>
  15. #include "6lowpan_i.h"
  16. static struct dentry *lowpan_debugfs;
  17. int lowpan_dev_debugfs_init(struct net_device *dev)
  18. {
  19. struct lowpan_priv *lpriv = lowpan_priv(dev);
  20. /* creating the root */
  21. lpriv->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs);
  22. if (!lpriv->iface_debugfs)
  23. goto fail;
  24. return 0;
  25. fail:
  26. return -EINVAL;
  27. }
  28. void lowpan_dev_debugfs_exit(struct net_device *dev)
  29. {
  30. debugfs_remove_recursive(lowpan_priv(dev)->iface_debugfs);
  31. }
  32. int __init lowpan_debugfs_init(void)
  33. {
  34. lowpan_debugfs = debugfs_create_dir("6lowpan", NULL);
  35. if (!lowpan_debugfs)
  36. return -EINVAL;
  37. return 0;
  38. }
  39. void lowpan_debugfs_exit(void)
  40. {
  41. debugfs_remove_recursive(lowpan_debugfs);
  42. }