-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Acked-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
- Loading branch information
Showing
3 changed files
with
16 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,6 @@ | |
* Added support for a Unix98-style ptmx device. | ||
* -- C. Scott Ananian <[email protected]>, 14-Jan-1998 | ||
* | ||
* When reading this code see also fs/devpts. In particular note that the | ||
* driver_data field is used by the devpts side as a binding to the devpts | ||
* inode. | ||
*/ | ||
|
||
#include <linux/module.h> | ||
|
@@ -59,7 +56,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp) | |
#ifdef CONFIG_UNIX98_PTYS | ||
if (tty->driver == ptm_driver) { | ||
mutex_lock(&devpts_mutex); | ||
devpts_pty_kill(tty->link); | ||
devpts_pty_kill(tty->link->driver_data); | ||
mutex_unlock(&devpts_mutex); | ||
} | ||
#endif | ||
|
@@ -651,7 +648,9 @@ static int ptmx_open(struct inode *inode, struct file *filp) | |
|
||
tty_add_file(tty, filp); | ||
|
||
slave_inode = devpts_pty_new(inode, tty->link); | ||
slave_inode = devpts_pty_new(inode, | ||
MKDEV(UNIX98_PTY_SLAVE_MAJOR, index), index, | ||
tty->link); | ||
if (IS_ERR(slave_inode)) { | ||
retval = PTR_ERR(slave_inode); | ||
goto err_release; | ||
|
@@ -662,6 +661,7 @@ static int ptmx_open(struct inode *inode, struct file *filp) | |
goto err_release; | ||
|
||
tty_unlock(tty); | ||
tty->link->driver_data = slave_inode; | ||
return 0; | ||
err_release: | ||
tty_unlock(tty); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters