Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113464
b: refs/heads/master
c: 4a2b5fd
h: refs/heads/master
v: v3
  • Loading branch information
Sukadev Bhattiprolu authored and Linus Torvalds committed Oct 13, 2008
1 parent f370699 commit 0b52238
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf970ee46e0fb363c8df4393229121d54330a98e
refs/heads/master: 4a2b5fddd53b80efcb3266ee36e23b8de28e761a
31 changes: 16 additions & 15 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,19 +1376,6 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
struct tty_struct *tty;
int retval;

/* check whether we're reopening an existing tty */
tty = tty_driver_lookup_tty(driver, idx);

if (IS_ERR(tty))
return tty;

if (tty) {
retval = tty_reopen(tty);
if (retval)
return ERR_PTR(retval);
return tty;
}

/* Check if pty master is being opened multiple times */
if (driver->subtype == PTY_TYPE_MASTER &&
(driver->flags & TTY_DRIVER_DEVPTS_MEM) && !first_ok)
Expand Down Expand Up @@ -1790,7 +1777,7 @@ void tty_release_dev(struct file *filp)

static int __tty_open(struct inode *inode, struct file *filp)
{
struct tty_struct *tty;
struct tty_struct *tty = NULL;
int noctty, retval;
struct tty_driver *driver;
int index;
Expand Down Expand Up @@ -1847,7 +1834,21 @@ static int __tty_open(struct inode *inode, struct file *filp)
return -ENODEV;
}
got_driver:
tty = tty_init_dev(driver, index, 0);
if (!tty) {
/* check whether we're reopening an existing tty */
tty = tty_driver_lookup_tty(driver, index);

if (IS_ERR(tty))
return PTR_ERR(tty);
}

if (tty) {
retval = tty_reopen(tty);
if (retval)
tty = ERR_PTR(retval);
} else
tty = tty_init_dev(driver, index, 0);

mutex_unlock(&tty_mutex);
tty_driver_kref_put(driver);
if (IS_ERR(tty))
Expand Down

0 comments on commit 0b52238

Please sign in to comment.