]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/isdn/hysdn/hysdn_procconf.c
procfs: new helper - PDE_DATA(inode)
[mirror_ubuntu-bionic-kernel.git] / drivers / isdn / hysdn / hysdn_procconf.c
index 8023d2510fbaba2f6bc80bd291bc6cf56ef566f2..73079213ec94611a8fed1677c887e5c3794f4d72 100644 (file)
@@ -229,23 +229,12 @@ static int
 hysdn_conf_open(struct inode *ino, struct file *filep)
 {
        hysdn_card *card;
-       struct proc_dir_entry *pd;
        struct conf_writedata *cnf;
        char *cp, *tmp;
 
        /* now search the addressed card */
        mutex_lock(&hysdn_conf_mutex);
-       card = card_root;
-       while (card) {
-               pd = card->procconf;
-               if (pd == PDE(ino))
-                       break;
-               card = card->next;      /* search next entry */
-       }
-       if (!card) {
-               mutex_unlock(&hysdn_conf_mutex);
-               return (-ENODEV);       /* device is unknown/invalid */
-       }
+       card = PDE_DATA(ino);
        if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
                hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x",
                             filep->f_cred->fsuid, filep->f_cred->fsgid,
@@ -317,21 +306,9 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
        hysdn_card *card;
        struct conf_writedata *cnf;
        int retval = 0;
-       struct proc_dir_entry *pd;
 
        mutex_lock(&hysdn_conf_mutex);
-       /* search the addressed card */
-       card = card_root;
-       while (card) {
-               pd = card->procconf;
-               if (pd == PDE(ino))
-                       break;
-               card = card->next;      /* search next entry */
-       }
-       if (!card) {
-               mutex_unlock(&hysdn_conf_mutex);
-               return (-ENODEV);       /* device is unknown/invalid */
-       }
+       card = PDE_DATA(ino);
        if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
                hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x",
                             filep->f_cred->fsuid, filep->f_cred->fsgid,
@@ -394,10 +371,11 @@ hysdn_procconf_init(void)
        while (card) {
 
                sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid);
-               if ((card->procconf = (void *) proc_create(conf_name,
+               if ((card->procconf = (void *) proc_create_data(conf_name,
                                                           S_IFREG | S_IRUGO | S_IWUSR,
                                                           hysdn_proc_entry,
-                                                          &conf_fops)) != NULL) {
+                                                          &conf_fops,
+                                                          card)) != NULL) {
                        hysdn_proclog_init(card);       /* init the log file entry */
                }
                card = card->next;      /* next entry */