]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/pci/proc.c
procfs: new helper - PDE_DATA(inode)
[mirror_ubuntu-bionic-kernel.git] / drivers / pci / proc.c
index 0b009470e6db548005b6f66539b18e372e8f2261..12e4fb5824c1e6a3dc88aa276e13f2bc7cc55bc5 100644 (file)
@@ -46,9 +46,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
 static ssize_t
 proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
-       const struct inode *ino = file_inode(file);
-       const struct proc_dir_entry *dp = PDE(ino);
-       struct pci_dev *dev = dp->data;
+       struct pci_dev *dev = PDE_DATA(file_inode(file));
        unsigned int pos = *ppos;
        unsigned int cnt, size;
 
@@ -59,7 +57,7 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp
         */
 
        if (capable(CAP_SYS_ADMIN))
-               size = dp->size;
+               size = dev->cfg_size;
        else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
                size = 128;
        else
@@ -133,10 +131,9 @@ static ssize_t
 proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos)
 {
        struct inode *ino = file_inode(file);
-       const struct proc_dir_entry *dp = PDE(ino);
-       struct pci_dev *dev = dp->data;
+       struct pci_dev *dev = PDE_DATA(ino);
        int pos = *ppos;
-       int size = dp->size;
+       int size = dev->cfg_size;
        int cnt;
 
        if (pos >= size)
@@ -200,7 +197,7 @@ proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, lof
        pci_config_pm_runtime_put(dev);
 
        *ppos = pos;
-       i_size_write(ino, dp->size);
+       i_size_write(ino, dev->cfg_size);
        return nbytes;
 }
 
@@ -212,8 +209,7 @@ struct pci_filp_private {
 static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
                               unsigned long arg)
 {
-       const struct proc_dir_entry *dp = PDE(file_inode(file));
-       struct pci_dev *dev = dp->data;
+       struct pci_dev *dev = PDE_DATA(file_inode(file));
 #ifdef HAVE_PCI_MMAP
        struct pci_filp_private *fpriv = file->private_data;
 #endif /* HAVE_PCI_MMAP */
@@ -253,9 +249,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 #ifdef HAVE_PCI_MMAP
 static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct inode *inode = file_inode(file);
-       const struct proc_dir_entry *dp = PDE(inode);
-       struct pci_dev *dev = dp->data;
+       struct pci_dev *dev = PDE_DATA(file_inode(file));
        struct pci_filp_private *fpriv = file->private_data;
        int i, ret;