Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325592
b: refs/heads/master
c: 04831dc
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Jun 14, 2012
1 parent cf939c2 commit 31d6705
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 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: 9bb8a3d4109f3b267cca9f6f071e2298eed4f593
refs/heads/master: 04831dc154df9b83c3e5fd54b18448da507871f7
18 changes: 17 additions & 1 deletion trunk/drivers/tty/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,9 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
if (retval < 0)
goto err_deinit_tty;

if (!tty->port)
tty->port = driver->ports[idx];

/*
* Structures all installed ... call the ldisc open routines.
* If we fail here just call release_tty to clean up. No need
Expand Down Expand Up @@ -3094,6 +3097,7 @@ static void destruct_tty_driver(struct kref *kref)
kfree(p);
cdev_del(&driver->cdev);
}
kfree(driver->ports);
kfree(driver);
}

Expand Down Expand Up @@ -3132,6 +3136,18 @@ int tty_register_driver(struct tty_driver *driver)
if (!p)
return -ENOMEM;
}
/*
* There is too many lines in PTY and we won't need the array there
* since it has an ->install hook where it assigns ports properly.
*/
if (driver->type != TTY_DRIVER_TYPE_PTY) {
driver->ports = kcalloc(driver->num, sizeof(struct tty_port *),
GFP_KERNEL);
if (!driver->ports) {
error = -ENOMEM;
goto err_free_p;
}
}

if (!driver->major) {
error = alloc_chrdev_region(&dev, driver->minor_start,
Expand Down Expand Up @@ -3190,7 +3206,7 @@ int tty_register_driver(struct tty_driver *driver)
unregister_chrdev_region(dev, driver->num);
driver->ttys = NULL;
driver->termios = NULL;
err_free_p:
err_free_p: /* destruct_tty_driver will free driver->ports */
kfree(p);
return error;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/tty_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ struct tty_driver {
* Pointer to the tty data structures
*/
struct tty_struct **ttys;
struct tty_port **ports;
struct ktermios **termios;
void *driver_state;

Expand Down

0 comments on commit 31d6705

Please sign in to comment.