drivers: use non-racy method for proc entries creation (2)

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 <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Peter Osterlund <[email protected]>
Cc: Bartlomiej Zolnierkiewicz <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Denis V. Lunev 2008-04-29 01:02:35 -07:00 • committed by Linus Torvalds
commit c7705f3449
12 changed files with 33 additions and 68 deletions

View file

@ -822,6 +822,7 @@ static int ide_drivers_open(struct inode *inode, struct file *file)
}
static const struct file_operations ide_drivers_operations = {
.owner = THIS_MODULE,
.open = ide_drivers_open,
.read = seq_read,
.llseek = seq_lseek,
@ -830,16 +831,12 @@ static const struct file_operations ide_drivers_operations = {
void proc_ide_create(void)
{
struct proc_dir_entry *entry;
proc_ide_root = proc_mkdir("ide", NULL);
if (!proc_ide_root)
return;
entry = create_proc_entry("drivers", 0, proc_ide_root);
if (entry)
entry->proc_fops = &ide_drivers_operations;
proc_create("drivers", 0, proc_ide_root, &ide_drivers_operations);
}
void proc_ide_destroy(void)