xref: /linux/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c (revision 08606cb528bed9f265ea8a99b0c310f3eba0ca89)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) Meta Platforms, Inc. and affiliates. */
3 
4 #include <linux/debugfs.h>
5 #include <linux/pci.h>
6 
7 #include "fbnic.h"
8 
9 static struct dentry *fbnic_dbg_root;
10 
11 void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
12 {
13 	struct pci_dev *pdev = to_pci_dev(fbd->dev);
14 	const char *name = pci_name(pdev);
15 
16 	fbd->dbg_fbd = debugfs_create_dir(name, fbnic_dbg_root);
17 }
18 
19 void fbnic_dbg_fbd_exit(struct fbnic_dev *fbd)
20 {
21 	debugfs_remove_recursive(fbd->dbg_fbd);
22 	fbd->dbg_fbd = NULL;
23 }
24 
25 void fbnic_dbg_init(void)
26 {
27 	fbnic_dbg_root = debugfs_create_dir(fbnic_driver_name, NULL);
28 }
29 
30 void fbnic_dbg_exit(void)
31 {
32 	debugfs_remove_recursive(fbnic_dbg_root);
33 	fbnic_dbg_root = NULL;
34 }
35