]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
TTY: devpts, don't care about TTY in devpts_get_tty
authorJiri Slaby <jslaby@suse.cz>
Thu, 18 Oct 2012 20:26:27 +0000 (22:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Oct 2012 23:50:12 +0000 (16:50 -0700)
The goal is to stop setting and using tty->driver_data in devpts code.
It should be used solely by the driver's code, pty in this case.

First, here we remove TTY from devpts_get_tty and rename it to
devpts_get_priv. Note we do not remove type safety, we just shift the
[implicit] (void *) cast one layer up.

index was unused in devpts_get_tty, so remove that from the prototype
too.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/pty.c
fs/devpts/inode.c
include/linux/devpts_fs.h

index a82b39939a9cab4fc02a6d6d0be13607284d68ce..65f767154d124a8c2afe8813423ed15b801b1152 100644 (file)
@@ -547,7 +547,7 @@ static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver,
        struct tty_struct *tty;
 
        mutex_lock(&devpts_mutex);
-       tty = devpts_get_tty(pts_inode, idx);
+       tty = devpts_get_priv(pts_inode);
        mutex_unlock(&devpts_mutex);
        /* Master must be open before slave */
        if (!tty)
index 14afbabe65464e226549894404ec1af9d1a3f747..47965807884d553f29310e772f3767c37ca31caa 100644 (file)
@@ -593,10 +593,10 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
        return ret;
 }
 
-struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
+void *devpts_get_priv(struct inode *pts_inode)
 {
        struct dentry *dentry;
-       struct tty_struct *tty;
+       void *priv = NULL;
 
        BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
 
@@ -605,13 +605,12 @@ struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
        if (!dentry)
                return NULL;
 
-       tty = NULL;
        if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC)
-               tty = (struct tty_struct *)pts_inode->i_private;
+               priv = pts_inode->i_private;
 
        dput(dentry);
 
-       return tty;
+       return priv;
 }
 
 void devpts_pty_kill(struct tty_struct *tty)
index 5ce0e5fd712e0fe67d0e05b455fffbb85c16fb7c..de635a5505eae52b64fe25064cacfef4c6ec3130 100644 (file)
@@ -21,8 +21,8 @@ int devpts_new_index(struct inode *ptmx_inode);
 void devpts_kill_index(struct inode *ptmx_inode, int idx);
 /* mknod in devpts */
 int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty);
-/* get tty structure */
-struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number);
+/* get private structure */
+void *devpts_get_priv(struct inode *pts_inode);
 /* unlink */
 void devpts_pty_kill(struct tty_struct *tty);
 
@@ -36,8 +36,7 @@ static inline int devpts_pty_new(struct inode *ptmx_inode,
 {
        return -EINVAL;
 }
-static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode,
-               int number)
+static inline void *devpts_get_priv(struct inode *pts_inode)
 {
        return NULL;
 }