mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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:
parent
1b50221738
commit
c7705f3449
12 changed files with 33 additions and 68 deletions
|
|
@ -293,6 +293,7 @@ static int proc_bus_pci_release(struct inode *inode, struct file *file)
|
|||
#endif /* HAVE_PCI_MMAP */
|
||||
|
||||
static const struct file_operations proc_bus_pci_operations = {
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = proc_bus_pci_lseek,
|
||||
.read = proc_bus_pci_read,
|
||||
.write = proc_bus_pci_write,
|
||||
|
|
@ -406,11 +407,10 @@ int pci_proc_attach_device(struct pci_dev *dev)
|
|||
}
|
||||
|
||||
sprintf(name, "%02x.%x", PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
|
||||
e = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, bus->procdir);
|
||||
e = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR, bus->procdir,
|
||||
&proc_bus_pci_operations, dev);
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
e->proc_fops = &proc_bus_pci_operations;
|
||||
e->data = dev;
|
||||
e->size = dev->cfg_size;
|
||||
dev->procent = e;
|
||||
|
||||
|
|
@ -462,6 +462,7 @@ static int proc_bus_pci_dev_open(struct inode *inode, struct file *file)
|
|||
return seq_open(file, &proc_bus_pci_devices_op);
|
||||
}
|
||||
static const struct file_operations proc_bus_pci_dev_operations = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_bus_pci_dev_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
|
|
@ -470,12 +471,10 @@ static const struct file_operations proc_bus_pci_dev_operations = {
|
|||
|
||||
static int __init pci_proc_init(void)
|
||||
{
|
||||
struct proc_dir_entry *entry;
|
||||
struct pci_dev *dev = NULL;
|
||||
proc_bus_pci_dir = proc_mkdir("bus/pci", NULL);
|
||||
entry = create_proc_entry("devices", 0, proc_bus_pci_dir);
|
||||
if (entry)
|
||||
entry->proc_fops = &proc_bus_pci_dev_operations;
|
||||
proc_create("devices", 0, proc_bus_pci_dir,
|
||||
&proc_bus_pci_dev_operations);
|
||||
proc_initialized = 1;
|
||||
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
|
||||
pci_proc_attach_device(dev);
|
||||
|
|
|
|||
Loading…
Reference in a new issue