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
21#define DEBUGFS_FILENAME "udelay_test"21#define DEBUGFS_FILENAME "udelay_test"
22 22
23static DEFINE_MUTEX(udelay_test_lock);23static DEFINE_MUTEX(udelay_test_lock);
24static struct dentry *udelay_test_debugfs_file;
25static int udelay_test_usecs;24static int udelay_test_usecs;
26static int udelay_test_iterations = DEFAULT_ITERATIONS;25static int udelay_test_iterations = DEFAULT_ITERATIONS;
27 26
@@ -138,8 +137,8 @@ static const struct file_operations udelay_test_debugfs_ops = { · 110 unmodified lines
138static int __init udelay_test_init(void)137static int __init udelay_test_init(void)
139{138{
140 mutex_lock(&udelay_test_lock);139 mutex_lock(&udelay_test_lock);
141 udelay_test_debugfs_file = debugfs_create_file(DEBUGFS_FILENAME,140 debugfs_create_file(DEBUGFS_FILENAME, S_IRUSR, NULL, NULL,
142 S_IRUSR, NULL, NULL, &udelay_test_debugfs_ops);141 &udelay_test_debugfs_ops);
143 mutex_unlock(&udelay_test_lock);142 mutex_unlock(&udelay_test_lock);
144 143
145 return 0;144 return 0;
@@ -150,7 +149,7 @@ module_init(udelay_test_init); · 4 unmodified lines
150static void __exit udelay_test_exit(void)149static void __exit udelay_test_exit(void)
151{150{
152 mutex_lock(&udelay_test_lock);151 mutex_lock(&udelay_test_lock);
153 debugfs_remove(udelay_test_debugfs_file);152 debugfs_remove(debugfs_lookup(DEBUGFS_FILENAME, NULL));
154 mutex_unlock(&udelay_test_lock);153 mutex_unlock(&udelay_test_lock);
155}154}
156 155

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