drivers: use non-racy method for proc entries creation
Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data be setup before gluing PDE to main tree. Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
0fd6894682
commit
1b50221738
@ -249,6 +249,7 @@ static int proc_viotape_open(struct inode *inode, struct file *file)
|
||||
}
|
||||
|
||||
static const struct file_operations proc_viotape_operations = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_viotape_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
@ -915,7 +916,6 @@ static struct vio_driver viotape_driver = {
|
||||
int __init viotap_init(void)
|
||||
{
|
||||
int ret;
|
||||
struct proc_dir_entry *e;
|
||||
|
||||
if (!firmware_has_feature(FW_FEATURE_ISERIES))
|
||||
return -ENODEV;
|
||||
@ -968,11 +968,8 @@ int __init viotap_init(void)
|
||||
if (ret)
|
||||
goto unreg_class;
|
||||
|
||||
e = create_proc_entry("iSeries/viotape", S_IFREG|S_IRUGO, NULL);
|
||||
if (e) {
|
||||
e->owner = THIS_MODULE;
|
||||
e->proc_fops = &proc_viotape_operations;
|
||||
}
|
||||
proc_create("iSeries/viotape", S_IFREG|S_IRUGO, NULL,
|
||||
&proc_viotape_operations);
|
||||
|
||||
return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user