Commit 22f00b69f6a7e1e18e821979a23e8307c2de9888
Committed by
Ingo Molnar
1 parent
65cf8f866f
Exists in
master
and in
4 other branches
rcu: Use debugfs_remove_recursive() simplify code.
Suggested by Josh Triplett. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: laijs@cn.fujitsu.com Cc: dipankar@in.ibm.com Cc: akpm@linux-foundation.org Cc: mathieu.desnoyers@polymtl.ca Cc: josht@linux.vnet.ibm.com Cc: dvhltc@us.ibm.com Cc: niv@us.ibm.com Cc: peterz@infradead.org Cc: rostedt@goodmis.org Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> LKML-Reference: <12509746132173-git-send-email-> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 15 additions and 30 deletions Side-by-side Diff
kernel/rcutree_trace.c
... | ... | @@ -265,62 +265,47 @@ |
265 | 265 | }; |
266 | 266 | |
267 | 267 | static struct dentry *rcudir; |
268 | -static struct dentry *datadir; | |
269 | -static struct dentry *datadir_csv; | |
270 | -static struct dentry *gpdir; | |
271 | -static struct dentry *hierdir; | |
272 | -static struct dentry *rcu_pendingdir; | |
273 | 268 | |
274 | 269 | static int __init rcuclassic_trace_init(void) |
275 | 270 | { |
271 | + struct dentry *retval; | |
272 | + | |
276 | 273 | rcudir = debugfs_create_dir("rcu", NULL); |
277 | 274 | if (!rcudir) |
278 | - goto out; | |
275 | + goto free_out; | |
279 | 276 | |
280 | - datadir = debugfs_create_file("rcudata", 0444, rcudir, | |
277 | + retval = debugfs_create_file("rcudata", 0444, rcudir, | |
281 | 278 | NULL, &rcudata_fops); |
282 | - if (!datadir) | |
279 | + if (!retval) | |
283 | 280 | goto free_out; |
284 | 281 | |
285 | - datadir_csv = debugfs_create_file("rcudata.csv", 0444, rcudir, | |
282 | + retval = debugfs_create_file("rcudata.csv", 0444, rcudir, | |
286 | 283 | NULL, &rcudata_csv_fops); |
287 | - if (!datadir_csv) | |
284 | + if (!retval) | |
288 | 285 | goto free_out; |
289 | 286 | |
290 | - gpdir = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops); | |
291 | - if (!gpdir) | |
287 | + retval = debugfs_create_file("rcugp", 0444, rcudir, NULL, &rcugp_fops); | |
288 | + if (!retval) | |
292 | 289 | goto free_out; |
293 | 290 | |
294 | - hierdir = debugfs_create_file("rcuhier", 0444, rcudir, | |
291 | + retval = debugfs_create_file("rcuhier", 0444, rcudir, | |
295 | 292 | NULL, &rcuhier_fops); |
296 | - if (!hierdir) | |
293 | + if (!retval) | |
297 | 294 | goto free_out; |
298 | 295 | |
299 | - rcu_pendingdir = debugfs_create_file("rcu_pending", 0444, rcudir, | |
296 | + retval = debugfs_create_file("rcu_pending", 0444, rcudir, | |
300 | 297 | NULL, &rcu_pending_fops); |
301 | - if (!rcu_pendingdir) | |
298 | + if (!retval) | |
302 | 299 | goto free_out; |
303 | 300 | return 0; |
304 | 301 | free_out: |
305 | - if (datadir) | |
306 | - debugfs_remove(datadir); | |
307 | - if (datadir_csv) | |
308 | - debugfs_remove(datadir_csv); | |
309 | - if (gpdir) | |
310 | - debugfs_remove(gpdir); | |
311 | - debugfs_remove(rcudir); | |
312 | -out: | |
302 | + debugfs_remove_recursive(rcudir); | |
313 | 303 | return 1; |
314 | 304 | } |
315 | 305 | |
316 | 306 | static void __exit rcuclassic_trace_cleanup(void) |
317 | 307 | { |
318 | - debugfs_remove(datadir); | |
319 | - debugfs_remove(datadir_csv); | |
320 | - debugfs_remove(gpdir); | |
321 | - debugfs_remove(hierdir); | |
322 | - debugfs_remove(rcu_pendingdir); | |
323 | - debugfs_remove(rcudir); | |
308 | + debugfs_remove_recursive(rcudir); | |
324 | 309 | } |
325 | 310 | |
326 | 311 |