File: ice_debugfs.c

package info (click to toggle)
linux 6.18.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,742,212 kB
  • sloc: ansic: 26,783,651; asm: 272,129; sh: 148,799; python: 79,242; makefile: 57,742; perl: 36,527; xml: 19,542; cpp: 5,911; yacc: 4,939; lex: 2,950; awk: 1,607; sed: 30; ruby: 25
file content (47 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022, Intel Corporation. */

#include <linux/debugfs.h>
#include "ice.h"

static struct dentry *ice_debugfs_root;

int ice_debugfs_pf_init(struct ice_pf *pf)
{
	const char *name = pci_name(pf->pdev);

	pf->ice_debugfs_pf = debugfs_create_dir(name, ice_debugfs_root);
	if (IS_ERR(pf->ice_debugfs_pf))
		return PTR_ERR(pf->ice_debugfs_pf);

	return 0;
}

/**
 * ice_debugfs_pf_deinit - cleanup PF's debugfs
 * @pf: pointer to the PF struct
 */
void ice_debugfs_pf_deinit(struct ice_pf *pf)
{
	debugfs_remove_recursive(pf->ice_debugfs_pf);
	pf->ice_debugfs_pf = NULL;
}

/**
 * ice_debugfs_init - create root directory for debugfs entries
 */
void ice_debugfs_init(void)
{
	ice_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
	if (IS_ERR(ice_debugfs_root))
		pr_info("init of debugfs failed\n");
}

/**
 * ice_debugfs_exit - remove debugfs entries
 */
void ice_debugfs_exit(void)
{
	debugfs_remove_recursive(ice_debugfs_root);
	ice_debugfs_root = NULL;
}