| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
/* Copyright (c) 2022, Intel Corporation. */ |
| 3 |
|
| 4 |
#include <linux/debugfs.h> |
| 5 |
#include "ice.h" |
| 6 |
|
| 7 |
static struct dentry *ice_debugfs_root; |
| 8 |
|
| 9 |
int ice_debugfs_pf_init(struct ice_pf *pf) |
| 10 |
{ |
| 11 |
const char *name = pci_name(pf->pdev); |
| 12 |
|
| 13 |
pf->ice_debugfs_pf = debugfs_create_dir(name, ice_debugfs_root); |
| 14 |
if (IS_ERR(pf->ice_debugfs_pf)) |
| 15 |
return PTR_ERR(pf->ice_debugfs_pf); |
| 16 |
|
| 17 |
return 0; |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* ice_debugfs_pf_deinit - cleanup PF's debugfs |
| 22 |
* @pf: pointer to the PF struct |
| 23 |
*/ |
| 24 |
void ice_debugfs_pf_deinit(struct ice_pf *pf) |
| 25 |
{ |
| 26 |
debugfs_remove_recursive(pf->ice_debugfs_pf); |
| 27 |
pf->ice_debugfs_pf = NULL; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* ice_debugfs_init - create root directory for debugfs entries |
| 32 |
*/ |
| 33 |
void ice_debugfs_init(void) |
| 34 |
{ |
| 35 |
ice_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); |
| 36 |
if (IS_ERR(ice_debugfs_root)) |
| 37 |
pr_info("init of debugfs failed\n"); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* ice_debugfs_exit - remove debugfs entries |
| 42 |
*/ |
| 43 |
void ice_debugfs_exit(void) |
| 44 |
{ |
| 45 |
debugfs_remove_recursive(ice_debugfs_root); |
| 46 |
ice_debugfs_root = NULL; |
| 47 |
} |