diff options
author | Denis V. Lunev <den@openvz.org> | 2008-04-29 04:02:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:22 -0400 |
commit | c7705f3449c7edd5c1744871097f93977227afc4 (patch) | |
tree | d2f121a4b1ae3ae458db76ec0210ea2172c31e5a /drivers/pci/proc.c | |
parent | 1b50221738108c438d5f25c7a043fb89e9e27044 (diff) |
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 <den@openvz.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Peter Osterlund <petero2@telia.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Neil Brown <neilb@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pci/proc.c')
-rw-r--r-- | drivers/pci/proc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 7b5e45b2fd16..963a97642ae9 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -293,6 +293,7 @@ static int proc_bus_pci_release(struct inode *inode, struct file *file) | |||
293 | #endif /* HAVE_PCI_MMAP */ | 293 | #endif /* HAVE_PCI_MMAP */ |
294 | 294 | ||
295 | static const struct file_operations proc_bus_pci_operations = { | 295 | static const struct file_operations proc_bus_pci_operations = { |
296 | .owner = THIS_MODULE, | ||
296 | .llseek = proc_bus_pci_lseek, | 297 | .llseek = proc_bus_pci_lseek, |
297 | .read = proc_bus_pci_read, | 298 | .read = proc_bus_pci_read, |
298 | .write = proc_bus_pci_write, | 299 | .write = proc_bus_pci_write, |
@@ -406,11 +407,10 @@ int pci_proc_attach_device(struct pci_dev *dev) | |||
406 | } | 407 | } |
407 | 408 | ||
408 | sprintf(name, "%02x.%x", PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); | 409 | sprintf(name, "%02x.%x", PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); |
409 | e = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, bus->procdir); | 410 | e = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR, bus->procdir, |
411 | &proc_bus_pci_operations, dev); | ||
410 | if (!e) | 412 | if (!e) |
411 | return -ENOMEM; | 413 | return -ENOMEM; |
412 | e->proc_fops = &proc_bus_pci_operations; | ||
413 | e->data = dev; | ||
414 | e->size = dev->cfg_size; | 414 | e->size = dev->cfg_size; |
415 | dev->procent = e; | 415 | dev->procent = e; |
416 | 416 | ||
@@ -462,6 +462,7 @@ static int proc_bus_pci_dev_open(struct inode *inode, struct file *file) | |||
462 | return seq_open(file, &proc_bus_pci_devices_op); | 462 | return seq_open(file, &proc_bus_pci_devices_op); |
463 | } | 463 | } |
464 | static const struct file_operations proc_bus_pci_dev_operations = { | 464 | static const struct file_operations proc_bus_pci_dev_operations = { |
465 | .owner = THIS_MODULE, | ||
465 | .open = proc_bus_pci_dev_open, | 466 | .open = proc_bus_pci_dev_open, |
466 | .read = seq_read, | 467 | .read = seq_read, |
467 | .llseek = seq_lseek, | 468 | .llseek = seq_lseek, |
@@ -470,12 +471,10 @@ static const struct file_operations proc_bus_pci_dev_operations = { | |||
470 | 471 | ||
471 | static int __init pci_proc_init(void) | 472 | static int __init pci_proc_init(void) |
472 | { | 473 | { |
473 | struct proc_dir_entry *entry; | ||
474 | struct pci_dev *dev = NULL; | 474 | struct pci_dev *dev = NULL; |
475 | proc_bus_pci_dir = proc_mkdir("bus/pci", NULL); | 475 | proc_bus_pci_dir = proc_mkdir("bus/pci", NULL); |
476 | entry = create_proc_entry("devices", 0, proc_bus_pci_dir); | 476 | proc_create("devices", 0, proc_bus_pci_dir, |
477 | if (entry) | 477 | &proc_bus_pci_dev_operations); |
478 | entry->proc_fops = &proc_bus_pci_dev_operations; | ||
479 | proc_initialized = 1; | 478 | proc_initialized = 1; |
480 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | 479 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { |
481 | pci_proc_attach_device(dev); | 480 | pci_proc_attach_device(dev); |