Skip to content

Commit

Permalink
samples: use non-racy method for /proc/marker-example creation
Browse files Browse the repository at this point in the history
Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to
main tree.

Signed-off-by: Denis V. Lunev <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Denis V. Lunev authored and torvalds committed Apr 29, 2008
1 parent 659f865 commit 16e70f6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions samples/markers/marker-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ static struct file_operations mark_ops = {
static int example_init(void)
{
printk(KERN_ALERT "example init\n");
pentry_example = create_proc_entry("marker-example", 0444, NULL);
if (pentry_example)
pentry_example->proc_fops = &mark_ops;
else
pentry_example = proc_create("marker-example", 0444, NULL, &mark_ops);
if (!pentry_example)
return -EPERM;
return 0;
}
Expand Down

0 comments on commit 16e70f6

Please sign in to comment.