From: "Denis V. Lunev" Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to main tree. Signed-off-by: Denis V. Lunev Cc: Mathieu Desnoyers Cc: Alexey Dobriyan Cc: "Eric W. Biederman" Signed-off-by: Andrew Morton --- samples/markers/marker-example.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff -puN samples/markers/marker-example.c~samples-use-non-racy-method-for-proc-marker-example-creation samples/markers/marker-example.c --- a/samples/markers/marker-example.c~samples-use-non-racy-method-for-proc-marker-example-creation +++ a/samples/markers/marker-example.c @@ -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; } _