]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/devpts/inode.c
Merge tag 'v4.1-rockchip-socfixes1' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / fs / devpts / inode.c
index c71038079b47831bb14b58e375592044906091c3..add566303c684336cce3d8f9c4fa0f98678adafc 100644 (file)
@@ -10,6 +10,8 @@
  *
  * ------------------------------------------------------------------------- */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/fs.h>
@@ -148,10 +150,10 @@ static inline struct super_block *pts_sb_from_inode(struct inode *inode)
 
 /*
  * parse_mount_options():
- *     Set @opts to mount options specified in @data. If an option is not
- *     specified in @data, set it to its default value. The exception is
- *     'newinstance' option which can only be set/cleared on a mount (i.e.
- *     cannot be changed during remount).
+ *     Set @opts to mount options specified in @data. If an option is not
+ *     specified in @data, set it to its default value. The exception is
+ *     'newinstance' option which can only be set/cleared on a mount (i.e.
+ *     cannot be changed during remount).
  *
  * Note: @data may be NULL (in which case all options are set to default).
  */
@@ -225,7 +227,7 @@ static int parse_mount_options(char *data, int op, struct pts_mount_opts *opts)
                        break;
 #endif
                default:
-                       printk(KERN_ERR "devpts: called with bogus options\n");
+                       pr_err("called with bogus options\n");
                        return -EINVAL;
                }
        }
@@ -251,7 +253,7 @@ static int mknod_ptmx(struct super_block *sb)
        if (!uid_valid(root_uid) || !gid_valid(root_gid))
                return -EINVAL;
 
-       mutex_lock(&root->d_inode->i_mutex);
+       mutex_lock(&d_inode(root)->i_mutex);
 
        /* If we have already created ptmx node, return */
        if (fsi->ptmx_dentry) {
@@ -261,7 +263,7 @@ static int mknod_ptmx(struct super_block *sb)
 
        dentry = d_alloc_name(root, "ptmx");
        if (!dentry) {
-               printk(KERN_NOTICE "Unable to alloc dentry for ptmx node\n");
+               pr_err("Unable to alloc dentry for ptmx node\n");
                goto out;
        }
 
@@ -270,7 +272,7 @@ static int mknod_ptmx(struct super_block *sb)
         */
        inode = new_inode(sb);
        if (!inode) {
-               printk(KERN_ERR "Unable to alloc inode for ptmx node\n");
+               pr_err("Unable to alloc inode for ptmx node\n");
                dput(dentry);
                goto out;
        }
@@ -288,7 +290,7 @@ static int mknod_ptmx(struct super_block *sb)
        fsi->ptmx_dentry = dentry;
        rc = 0;
 out:
-       mutex_unlock(&root->d_inode->i_mutex);
+       mutex_unlock(&d_inode(root)->i_mutex);
        return rc;
 }
 
@@ -296,14 +298,14 @@ static void update_ptmx_mode(struct pts_fs_info *fsi)
 {
        struct inode *inode;
        if (fsi->ptmx_dentry) {
-               inode = fsi->ptmx_dentry->d_inode;
+               inode = d_inode(fsi->ptmx_dentry);
                inode->i_mode = S_IFCHR|fsi->mount_opts.ptmxmode;
        }
 }
 #else
 static inline void update_ptmx_mode(struct pts_fs_info *fsi)
 {
-       return;
+       return;
 }
 #endif
 
@@ -333,9 +335,11 @@ static int devpts_show_options(struct seq_file *seq, struct dentry *root)
        struct pts_mount_opts *opts = &fsi->mount_opts;
 
        if (opts->setuid)
-               seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, opts->uid));
+               seq_printf(seq, ",uid=%u",
+                          from_kuid_munged(&init_user_ns, opts->uid));
        if (opts->setgid)
-               seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, opts->gid));
+               seq_printf(seq, ",gid=%u",
+                          from_kgid_munged(&init_user_ns, opts->gid));
        seq_printf(seq, ",mode=%03o", opts->mode);
 #ifdef CONFIG_DEVPTS_MULTIPLE_INSTANCES
        seq_printf(seq, ",ptmxmode=%03o", opts->ptmxmode);
@@ -396,7 +400,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
        if (s->s_root)
                return 0;
 
-       printk(KERN_ERR "devpts: get root dentry failed\n");
+       pr_err("get root dentry failed\n");
 
 fail:
        return -ENOMEM;
@@ -598,18 +602,18 @@ struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
 
        sprintf(s, "%d", index);
 
-       mutex_lock(&root->d_inode->i_mutex);
+       mutex_lock(&d_inode(root)->i_mutex);
 
        dentry = d_alloc_name(root, s);
        if (dentry) {
                d_add(dentry, inode);
-               fsnotify_create(root->d_inode, dentry);
+               fsnotify_create(d_inode(root), dentry);
        } else {
                iput(inode);
                inode = ERR_PTR(-ENOMEM);
        }
 
-       mutex_unlock(&root->d_inode->i_mutex);
+       mutex_unlock(&d_inode(root)->i_mutex);
 
        return inode;
 }
@@ -654,7 +658,7 @@ void devpts_pty_kill(struct inode *inode)
 
        BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
 
-       mutex_lock(&root->d_inode->i_mutex);
+       mutex_lock(&d_inode(root)->i_mutex);
 
        dentry = d_find_alias(inode);
 
@@ -663,7 +667,7 @@ void devpts_pty_kill(struct inode *inode)
        dput(dentry);   /* d_alloc_name() in devpts_pty_new() */
        dput(dentry);           /* d_find_alias above */
 
-       mutex_unlock(&root->d_inode->i_mutex);
+       mutex_unlock(&d_inode(root)->i_mutex);
 }
 
 static int __init init_devpts_fs(void)