diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-10-18 16:26:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-22 19:50:12 -0400 |
commit | 162b97cfa21f816f39ede1944f2a4220e3cf8969 (patch) | |
tree | 6cd663b2b17c3013285148efd43a145d6dea9a5e /drivers/tty/pty.c | |
parent | 8fcbaa2b7f5b70dba9ed1c7f91d0a270ce752e2c (diff) |
TTY: devpts, return created inode from devpts_pty_new
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.
For the cleanup of layering, we will need the inode created in
devpts_pty_new to be stored into slave's driver_data. So we convert
devpts_pty_new to return the inode or an ERR_PTR-encoded error in case
of failure.
The move of 'inode = new_inode(sb);' from declarators to the code is
only cosmetical, but it makes the code easier to read.
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 | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 65f767154d12..9985b451e937 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -614,6 +614,7 @@ static const struct tty_operations pty_unix98_ops = { | |||
614 | static int ptmx_open(struct inode *inode, struct file *filp) | 614 | static int ptmx_open(struct inode *inode, struct file *filp) |
615 | { | 615 | { |
616 | struct tty_struct *tty; | 616 | struct tty_struct *tty; |
617 | struct inode *slave_inode; | ||
617 | int retval; | 618 | int retval; |
618 | int index; | 619 | int index; |
619 | 620 | ||
@@ -650,9 +651,11 @@ static int ptmx_open(struct inode *inode, struct file *filp) | |||
650 | 651 | ||
651 | tty_add_file(tty, filp); | 652 | tty_add_file(tty, filp); |
652 | 653 | ||
653 | retval = devpts_pty_new(inode, tty->link); | 654 | slave_inode = devpts_pty_new(inode, tty->link); |
654 | if (retval) | 655 | if (IS_ERR(slave_inode)) { |
656 | retval = PTR_ERR(slave_inode); | ||
655 | goto err_release; | 657 | goto err_release; |
658 | } | ||
656 | 659 | ||
657 | retval = ptm_driver->ops->open(tty, filp); | 660 | retval = ptm_driver->ops->open(tty, filp); |
658 | if (retval) | 661 | if (retval) |