History

time/debug: Remove dentry pointer for debugfs

There is no need to keep the dentry pointer around for the created debugfs file, as it is only needed when removing it from the system. When it is to be removed, ask debugfs itself for the pointer, to save on storage and make things a bit simpler.

Greg Kroah-Hartman committed 5 years ago

Commit 44511ab1 parent 1e28eed1 file · +3 −4Browse files

Unified · Split

kernel/time/test_udelay.c+3−4
@@ -21,7 +21,6 @@ · 20 unmodified lines
2121 #define DEBUGFS_FILENAME "udelay_test"
2222
2323 static DEFINE_MUTEX(udelay_test_lock);
24−static struct dentry *udelay_test_debugfs_file;
2524 static int udelay_test_usecs;
2625 static int udelay_test_iterations = DEFAULT_ITERATIONS;
2726
@@ -138,8 +137,8 @@ static const struct file_operations udelay_test_debugfs_ops = { · 110 unmodified lines
138137 static int __init udelay_test_init(void)
139138 {
140139 mutex_lock(&udelay_test_lock);
141− udelay_test_debugfs_file = debugfs_create_file(DEBUGFS_FILENAME,
142− S_IRUSR, NULL, NULL, &udelay_test_debugfs_ops);
140+ debugfs_create_file(DEBUGFS_FILENAME, S_IRUSR, NULL, NULL,
141+ &udelay_test_debugfs_ops);
143142 mutex_unlock(&udelay_test_lock);
144143
145144 return 0;
@@ -150,7 +149,7 @@ module_init(udelay_test_init); · 4 unmodified lines
150149 static void __exit udelay_test_exit(void)
151150 {
152151 mutex_lock(&udelay_test_lock);
153− debugfs_remove(udelay_test_debugfs_file);
152+ debugfs_remove(debugfs_lookup(DEBUGFS_FILENAME, NULL));
154153 mutex_unlock(&udelay_test_lock);
155154 }
156155

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t