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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
8fcbaa2b7f
commit
162b97cfa2
@@ -614,6 +614,7 @@ static const struct tty_operations pty_unix98_ops = {
|
||||
static int ptmx_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct tty_struct *tty;
|
||||
struct inode *slave_inode;
|
||||
int retval;
|
||||
int index;
|
||||
|
||||
@@ -650,9 +651,11 @@ static int ptmx_open(struct inode *inode, struct file *filp)
|
||||
|
||||
tty_add_file(tty, filp);
|
||||
|
||||
retval = devpts_pty_new(inode, tty->link);
|
||||
if (retval)
|
||||
slave_inode = devpts_pty_new(inode, tty->link);
|
||||
if (IS_ERR(slave_inode)) {
|
||||
retval = PTR_ERR(slave_inode);
|
||||
goto err_release;
|
||||
}
|
||||
|
||||
retval = ptm_driver->ops->open(tty, filp);
|
||||
if (retval)
|
||||
|
Reference in New Issue
Block a user