diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
commit | 20b4fb485227404329e41ad15588afad3df23050 (patch) | |
tree | f3e099f0ab3da8a93b447203e294d2bb22f6dc05 /drivers/pci | |
parent | b9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff) | |
parent | ac3e3c5b1164397656df81b9e9ab4991184d3236 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro,
Misc cleanups all over the place, mainly wrt /proc interfaces (switch
create_proc_entry to proc_create(), get rid of the deprecated
create_proc_read_entry() in favor of using proc_create_data() and
seq_file etc).
7kloc removed.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
don't bother with deferred freeing of fdtables
proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
proc: Make the PROC_I() and PDE() macros internal to procfs
proc: Supply a function to remove a proc entry by PDE
take cgroup_open() and cpuset_open() to fs/proc/base.c
ppc: Clean up scanlog
ppc: Clean up rtas_flash driver somewhat
hostap: proc: Use remove_proc_subtree()
drm: proc: Use remove_proc_subtree()
drm: proc: Use minor->index to label things, not PDE->name
drm: Constify drm_proc_list[]
zoran: Don't print proc_dir_entry data in debug
reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
proc: Supply an accessor for getting the data from a PDE's parent
airo: Use remove_proc_subtree()
rtl8192u: Don't need to save device proc dir PDE
rtl8187se: Use a dir under /proc/net/r8180/
proc: Add proc_mkdir_data()
proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
proc: Move PDE_NET() to fs/proc/proc_net.c
...
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/proc.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 0b009470e6db..08126087ec31 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -46,9 +46,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | |||
46 | static ssize_t | 46 | static ssize_t |
47 | proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 47 | proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) |
48 | { | 48 | { |
49 | const struct inode *ino = file_inode(file); | 49 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
50 | const struct proc_dir_entry *dp = PDE(ino); | ||
51 | struct pci_dev *dev = dp->data; | ||
52 | unsigned int pos = *ppos; | 50 | unsigned int pos = *ppos; |
53 | unsigned int cnt, size; | 51 | unsigned int cnt, size; |
54 | 52 | ||
@@ -59,7 +57,7 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp | |||
59 | */ | 57 | */ |
60 | 58 | ||
61 | if (capable(CAP_SYS_ADMIN)) | 59 | if (capable(CAP_SYS_ADMIN)) |
62 | size = dp->size; | 60 | size = dev->cfg_size; |
63 | else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | 61 | else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) |
64 | size = 128; | 62 | size = 128; |
65 | else | 63 | else |
@@ -133,10 +131,9 @@ static ssize_t | |||
133 | proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) | 131 | proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) |
134 | { | 132 | { |
135 | struct inode *ino = file_inode(file); | 133 | struct inode *ino = file_inode(file); |
136 | const struct proc_dir_entry *dp = PDE(ino); | 134 | struct pci_dev *dev = PDE_DATA(ino); |
137 | struct pci_dev *dev = dp->data; | ||
138 | int pos = *ppos; | 135 | int pos = *ppos; |
139 | int size = dp->size; | 136 | int size = dev->cfg_size; |
140 | int cnt; | 137 | int cnt; |
141 | 138 | ||
142 | if (pos >= size) | 139 | if (pos >= size) |
@@ -200,7 +197,7 @@ proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, lof | |||
200 | pci_config_pm_runtime_put(dev); | 197 | pci_config_pm_runtime_put(dev); |
201 | 198 | ||
202 | *ppos = pos; | 199 | *ppos = pos; |
203 | i_size_write(ino, dp->size); | 200 | i_size_write(ino, dev->cfg_size); |
204 | return nbytes; | 201 | return nbytes; |
205 | } | 202 | } |
206 | 203 | ||
@@ -212,8 +209,7 @@ struct pci_filp_private { | |||
212 | static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, | 209 | static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, |
213 | unsigned long arg) | 210 | unsigned long arg) |
214 | { | 211 | { |
215 | const struct proc_dir_entry *dp = PDE(file_inode(file)); | 212 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
216 | struct pci_dev *dev = dp->data; | ||
217 | #ifdef HAVE_PCI_MMAP | 213 | #ifdef HAVE_PCI_MMAP |
218 | struct pci_filp_private *fpriv = file->private_data; | 214 | struct pci_filp_private *fpriv = file->private_data; |
219 | #endif /* HAVE_PCI_MMAP */ | 215 | #endif /* HAVE_PCI_MMAP */ |
@@ -253,9 +249,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, | |||
253 | #ifdef HAVE_PCI_MMAP | 249 | #ifdef HAVE_PCI_MMAP |
254 | static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) | 250 | static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) |
255 | { | 251 | { |
256 | struct inode *inode = file_inode(file); | 252 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
257 | const struct proc_dir_entry *dp = PDE(inode); | ||
258 | struct pci_dev *dev = dp->data; | ||
259 | struct pci_filp_private *fpriv = file->private_data; | 253 | struct pci_filp_private *fpriv = file->private_data; |
260 | int i, ret; | 254 | int i, ret; |
261 | 255 | ||
@@ -425,7 +419,7 @@ int pci_proc_attach_device(struct pci_dev *dev) | |||
425 | &proc_bus_pci_operations, dev); | 419 | &proc_bus_pci_operations, dev); |
426 | if (!e) | 420 | if (!e) |
427 | return -ENOMEM; | 421 | return -ENOMEM; |
428 | e->size = dev->cfg_size; | 422 | proc_set_size(e, dev->cfg_size); |
429 | dev->procent = e; | 423 | dev->procent = e; |
430 | 424 | ||
431 | return 0; | 425 | return 0; |
@@ -433,20 +427,14 @@ int pci_proc_attach_device(struct pci_dev *dev) | |||
433 | 427 | ||
434 | int pci_proc_detach_device(struct pci_dev *dev) | 428 | int pci_proc_detach_device(struct pci_dev *dev) |
435 | { | 429 | { |
436 | struct proc_dir_entry *e; | 430 | proc_remove(dev->procent); |
437 | 431 | dev->procent = NULL; | |
438 | if ((e = dev->procent)) { | ||
439 | remove_proc_entry(e->name, dev->bus->procdir); | ||
440 | dev->procent = NULL; | ||
441 | } | ||
442 | return 0; | 432 | return 0; |
443 | } | 433 | } |
444 | 434 | ||
445 | int pci_proc_detach_bus(struct pci_bus* bus) | 435 | int pci_proc_detach_bus(struct pci_bus* bus) |
446 | { | 436 | { |
447 | struct proc_dir_entry *de = bus->procdir; | 437 | proc_remove(bus->procdir); |
448 | if (de) | ||
449 | remove_proc_entry(de->name, proc_bus_pci_dir); | ||
450 | return 0; | 438 | return 0; |
451 | } | 439 | } |
452 | 440 | ||