diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-10-18 16:26:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-22 19:50:13 -0400 |
commit | f11afb61247016162aa92225a337c1575556c9d9 (patch) | |
tree | ba77670c1ac540bb284e6975d6996b21ad23a272 /drivers/tty/pty.c | |
parent | 162b97cfa21f816f39ede1944f2a4220e3cf8969 (diff) |
TTY: devpts, do not set driver_data
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.
Now driver_data are managed only in the pty driver. devpts_pty_new is
switched to accept what we used to dig out of tty_struct, i.e. device
node number and index.
This also removes a note about driver_data being set outside of the
driver.
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>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 9985b451e937..559e5b27941a 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -4,9 +4,6 @@ | |||
4 | * Added support for a Unix98-style ptmx device. | 4 | * Added support for a Unix98-style ptmx device. |
5 | * -- C. Scott Ananian <cananian@alumni.princeton.edu>, 14-Jan-1998 | 5 | * -- C. Scott Ananian <cananian@alumni.princeton.edu>, 14-Jan-1998 |
6 | * | 6 | * |
7 | * When reading this code see also fs/devpts. In particular note that the | ||
8 | * driver_data field is used by the devpts side as a binding to the devpts | ||
9 | * inode. | ||
10 | */ | 7 | */ |
11 | 8 | ||
12 | #include <linux/module.h> | 9 | #include <linux/module.h> |
@@ -59,7 +56,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp) | |||
59 | #ifdef CONFIG_UNIX98_PTYS | 56 | #ifdef CONFIG_UNIX98_PTYS |
60 | if (tty->driver == ptm_driver) { | 57 | if (tty->driver == ptm_driver) { |
61 | mutex_lock(&devpts_mutex); | 58 | mutex_lock(&devpts_mutex); |
62 | devpts_pty_kill(tty->link); | 59 | devpts_pty_kill(tty->link->driver_data); |
63 | mutex_unlock(&devpts_mutex); | 60 | mutex_unlock(&devpts_mutex); |
64 | } | 61 | } |
65 | #endif | 62 | #endif |
@@ -651,7 +648,9 @@ static int ptmx_open(struct inode *inode, struct file *filp) | |||
651 | 648 | ||
652 | tty_add_file(tty, filp); | 649 | tty_add_file(tty, filp); |
653 | 650 | ||
654 | slave_inode = devpts_pty_new(inode, tty->link); | 651 | slave_inode = devpts_pty_new(inode, |
652 | MKDEV(UNIX98_PTY_SLAVE_MAJOR, index), index, | ||
653 | tty->link); | ||
655 | if (IS_ERR(slave_inode)) { | 654 | if (IS_ERR(slave_inode)) { |
656 | retval = PTR_ERR(slave_inode); | 655 | retval = PTR_ERR(slave_inode); |
657 | goto err_release; | 656 | goto err_release; |
@@ -662,6 +661,7 @@ static int ptmx_open(struct inode *inode, struct file *filp) | |||
662 | goto err_release; | 661 | goto err_release; |
663 | 662 | ||
664 | tty_unlock(tty); | 663 | tty_unlock(tty); |
664 | tty->link->driver_data = slave_inode; | ||
665 | return 0; | 665 | return 0; |
666 | err_release: | 666 | err_release: |
667 | tty_unlock(tty); | 667 | tty_unlock(tty); |