Commit 16e70f64a9358133a14872eb72cf39b6f38b6212

Authored by Denis V. Lunev
Committed by Linus Torvalds
1 parent 659f865ea6

samples: use non-racy method for /proc/marker-example creation

Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to
main tree.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff

samples/markers/marker-example.c
... ... @@ -33,10 +33,8 @@
33 33 static int example_init(void)
34 34 {
35 35 printk(KERN_ALERT "example init\n");
36   - pentry_example = create_proc_entry("marker-example", 0444, NULL);
37   - if (pentry_example)
38   - pentry_example->proc_fops = &mark_ops;
39   - else
  36 + pentry_example = proc_create("marker-example", 0444, NULL, &mark_ops);
  37 + if (!pentry_example)
40 38 return -EPERM;
41 39 return 0;
42 40 }