]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/staging/dgrp/dgrp_mon_ops.c
procfs: new helper - PDE_DATA(inode)
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / dgrp / dgrp_mon_ops.c
index 4792d056a36532b179968dda51f73b37ce56cb95..6edbbf069150b7b4b279cf5c81d578828dcb2da8 100644 (file)
@@ -49,7 +49,7 @@ static ssize_t dgrp_mon_read(struct file *, char __user *, size_t, loff_t *);
 static long dgrp_mon_ioctl(struct file *file, unsigned int cmd,
                           unsigned long arg);
 
-static const struct file_operations mon_ops = {
+const struct file_operations dgrp_mon_ops = {
        .owner   = THIS_MODULE,
        .read    = dgrp_mon_read,
        .unlocked_ioctl = dgrp_mon_ioctl,
@@ -57,20 +57,6 @@ static const struct file_operations mon_ops = {
        .release = dgrp_mon_release,
 };
 
-static struct inode_operations mon_inode_ops = {
-       .permission = dgrp_inode_permission
-};
-
-void dgrp_register_mon_hook(struct proc_dir_entry *de)
-{
-       struct nd_struct *node = de->data;
-
-       de->proc_iops = &mon_inode_ops;
-       de->proc_fops = &mon_ops;
-       node->nd_mon_de = de;
-       sema_init(&node->nd_mon_semaphore, 1);
-}
-
 /**
  * dgrp_mon_open() -- open /proc/dgrp/ports device for a PortServer
  * @inode: struct inode *
@@ -81,7 +67,6 @@ void dgrp_register_mon_hook(struct proc_dir_entry *de)
 static int dgrp_mon_open(struct inode *inode, struct file *file)
 {
        struct nd_struct *nd;
-       struct proc_dir_entry *de;
        struct timeval tv;
        uint32_t time;
        u8 *buf;
@@ -109,13 +94,7 @@ static int dgrp_mon_open(struct inode *inode, struct file *file)
        /*
         *  Get the node pointer, and fail if it doesn't exist.
         */
-       de = PDE(inode);
-       if (!de) {
-               rtn = -ENXIO;
-               goto done;
-       }
-
-       nd = (struct nd_struct *)de->data;
+       nd = PDE_DATA(inode);
        if (!nd) {
                rtn = -ENXIO;
                goto done;