ixgbe_debugfs.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*******************************************************************************
  2. Intel 10 Gigabit PCI Express Linux driver
  3. Copyright(c) 1999 - 2012 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  18. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  19. *******************************************************************************/
  20. #ifdef CONFIG_DEBUG_FS
  21. #include <linux/debugfs.h>
  22. #include <linux/module.h>
  23. #include "ixgbe.h"
  24. static struct dentry *ixgbe_dbg_root;
  25. /**
  26. * ixgbe_dbg_adapter_init - setup the debugfs directory for the adapter
  27. * @adapter: the adapter that is starting up
  28. **/
  29. void ixgbe_dbg_adapter_init(struct ixgbe_adapter *adapter)
  30. {
  31. const char *name = pci_name(adapter->pdev);
  32. adapter->ixgbe_dbg_adapter = debugfs_create_dir(name, ixgbe_dbg_root);
  33. if (!adapter->ixgbe_dbg_adapter)
  34. e_dev_err("debugfs entry for %s failed\n", name);
  35. }
  36. /**
  37. * ixgbe_dbg_adapter_exit - clear out the adapter's debugfs entries
  38. * @pf: the pf that is stopping
  39. **/
  40. void ixgbe_dbg_adapter_exit(struct ixgbe_adapter *adapter)
  41. {
  42. if (adapter->ixgbe_dbg_adapter)
  43. debugfs_remove_recursive(adapter->ixgbe_dbg_adapter);
  44. adapter->ixgbe_dbg_adapter = NULL;
  45. }
  46. /**
  47. * ixgbe_dbg_init - start up debugfs for the driver
  48. **/
  49. void ixgbe_dbg_init(void)
  50. {
  51. ixgbe_dbg_root = debugfs_create_dir(ixgbe_driver_name, NULL);
  52. if (ixgbe_dbg_root == NULL)
  53. pr_err("init of debugfs failed\n");
  54. }
  55. /**
  56. * ixgbe_dbg_exit - clean out the driver's debugfs entries
  57. **/
  58. void ixgbe_dbg_exit(void)
  59. {
  60. debugfs_remove_recursive(ixgbe_dbg_root);
  61. }
  62. #endif /* CONFIG_DEBUG_FS */