]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - sound/core/info.c
procfs: new helper - PDE_DATA(inode)
[mirror_ubuntu-bionic-kernel.git] / sound / core / info.c
index 6b368d25073b154d34b8258d59b509a1ffb6c6d2..3aa88640808e089a48d773b263902b3c3ca76ae1 100644 (file)
@@ -310,12 +310,10 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
        struct snd_info_entry *entry;
        struct snd_info_private_data *data;
        struct snd_info_buffer *buffer;
-       struct proc_dir_entry *p;
        int mode, err;
 
        mutex_lock(&info_mutex);
-       p = PDE(inode);
-       entry = p == NULL ? NULL : (struct snd_info_entry *)p->data;
+       entry = PDE_DATA(inode);
        if (entry == NULL || ! entry->p) {
                mutex_unlock(&info_mutex);
                return -ENODEV;
@@ -496,7 +494,7 @@ static long snd_info_entry_ioctl(struct file *file, unsigned int cmd,
 
 static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        struct snd_info_private_data *data;
        struct snd_info_entry *entry;
 
@@ -959,15 +957,21 @@ int snd_info_register(struct snd_info_entry * entry)
                return -ENXIO;
        root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
        mutex_lock(&info_mutex);
-       p = create_proc_entry(entry->name, entry->mode, root);
-       if (!p) {
-               mutex_unlock(&info_mutex);
-               return -ENOMEM;
+       if (S_ISDIR(entry->mode)) {
+               p = proc_mkdir_mode(entry->name, entry->mode, root);
+               if (!p) {
+                       mutex_unlock(&info_mutex);
+                       return -ENOMEM;
+               }
+       } else {
+               p = proc_create_data(entry->name, entry->mode, root,
+                                       &snd_info_entry_operations, entry);
+               if (!p) {
+                       mutex_unlock(&info_mutex);
+                       return -ENOMEM;
+               }
+               p->size = entry->size;
        }
-       if (!S_ISDIR(entry->mode))
-               p->proc_fops = &snd_info_entry_operations;
-       p->size = entry->size;
-       p->data = entry;
        entry->p = p;
        if (entry->parent)
                list_add_tail(&entry->list, &entry->parent->children);