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