Commit 67826db3 authored by Zhen Lei's avatar Zhen Lei Committed by Jakub Kicinski
Browse files

bna: Remove field bnad_dentry_files[] in struct bnad



Function debugfs_remove() recursively removes a directory, include all
files created by debugfs_create_file(). Therefore, there is no need to
explicitly record each file with member ->bnad_dentry_files[] and
explicitly delete them at the end. Remove field bnad_dentry_files[] and
its related processing codes for simplification.

Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241028020943.507-3-thunder.leizhen@huawei.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent bf8207ec
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -351,7 +351,6 @@ struct bnad {
	/* debugfs specific data */
	char	*regdata;
	u32	reglen;
	struct dentry *bnad_dentry_files[5];
	struct dentry *port_debugfs_root;
};

+5 −15
Original line number Diff line number Diff line
@@ -512,7 +512,6 @@ bnad_debugfs_init(struct bnad *bnad)

		for (i = 0; i < ARRAY_SIZE(bnad_debugfs_files); i++) {
			file = &bnad_debugfs_files[i];
			bnad->bnad_dentry_files[i] =
			debugfs_create_file(file->name,
					    file->mode,
					    bnad->port_debugfs_root,
@@ -526,15 +525,6 @@ bnad_debugfs_init(struct bnad *bnad)
void
bnad_debugfs_uninit(struct bnad *bnad)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(bnad_debugfs_files); i++) {
		if (bnad->bnad_dentry_files[i]) {
			debugfs_remove(bnad->bnad_dentry_files[i]);
			bnad->bnad_dentry_files[i] = NULL;
		}
	}

	/* Remove the pci_dev debugfs directory for the port */
	if (bnad->port_debugfs_root) {
		debugfs_remove(bnad->port_debugfs_root);