[Devel,RH7,1/3] ms/pty: Remove pty_unix98_shutdown()

Submitted by Pavel Tikhomirov on July 27, 2017, 3:40 p.m.

Details

Message ID 20170727154007.22917-1-ptikhomirov@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Pavel Tikhomirov July 27, 2017, 3:40 p.m.
From: Peter Hurley <peter@hurleysoftware.com>

cherry-pick ms commit c1e33af1ed552258405f2e5a72509af039c0441c

Take these one for the next patch to apply cleaner.
https://jira.sw.ru/browse/PSBM-67757

The tty core invokes the optional driver shutdown() just before
the optional driver remove() (shutdown() has access to the termios
and remove() does not). Because pty drivers must prevent the default
remove() action, the Unix98 pty drivers define a dummy remove() function.

Instead, release the slave index in the remove() method and delete the
optional shutdown() method.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 drivers/tty/pty.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 471d372..7ae7e1a 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -617,20 +617,13 @@  static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver,
 	return tty;
 }
 
-/* We have no need to install and remove our tty objects as devpts does all
-   the work for us */
-
 static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty)
 {
 	return pty_common_install(driver, tty, false);
 }
 
-static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
-{
-}
-
 /* this is called once with whichever end is closed last */
-static void pty_unix98_shutdown(struct tty_struct *tty)
+static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
 {
 	struct inode *ptmx_inode;
 
@@ -656,7 +649,6 @@  static const struct tty_operations ptm_unix98_ops = {
 	.set_termios = pty_set_termios,
 	.ioctl = pty_unix98_ioctl,
 	.resize = pty_resize,
-	.shutdown = pty_unix98_shutdown,
 	.cleanup = pty_cleanup
 };
 
@@ -672,7 +664,6 @@  static const struct tty_operations pty_unix98_ops = {
 	.chars_in_buffer = pty_chars_in_buffer,
 	.unthrottle = pty_unthrottle,
 	.set_termios = pty_set_termios,
-	.shutdown = pty_unix98_shutdown,
 	.cleanup = pty_cleanup,
 };
 

Comments

Konstantin Khorenko Aug. 7, 2017, 10:30 a.m.
JFYI: reverted this patchset, it will be resent with an additional patch.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 07/27/2017 06:40 PM, Pavel Tikhomirov wrote:
> From: Peter Hurley <peter@hurleysoftware.com>
>
> cherry-pick ms commit c1e33af1ed552258405f2e5a72509af039c0441c
>
> Take these one for the next patch to apply cleaner.
> https://jira.sw.ru/browse/PSBM-67757
>
> The tty core invokes the optional driver shutdown() just before
> the optional driver remove() (shutdown() has access to the termios
> and remove() does not). Because pty drivers must prevent the default
> remove() action, the Unix98 pty drivers define a dummy remove() function.
>
> Instead, release the slave index in the remove() method and delete the
> optional shutdown() method.
>
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> ---
>  drivers/tty/pty.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
> index 471d372..7ae7e1a 100644
> --- a/drivers/tty/pty.c
> +++ b/drivers/tty/pty.c
> @@ -617,20 +617,13 @@ static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver,
>  	return tty;
>  }
>
> -/* We have no need to install and remove our tty objects as devpts does all
> -   the work for us */
> -
>  static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty)
>  {
>  	return pty_common_install(driver, tty, false);
>  }
>
> -static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
> -{
> -}
> -
>  /* this is called once with whichever end is closed last */
> -static void pty_unix98_shutdown(struct tty_struct *tty)
> +static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
>  {
>  	struct inode *ptmx_inode;
>
> @@ -656,7 +649,6 @@ static const struct tty_operations ptm_unix98_ops = {
>  	.set_termios = pty_set_termios,
>  	.ioctl = pty_unix98_ioctl,
>  	.resize = pty_resize,
> -	.shutdown = pty_unix98_shutdown,
>  	.cleanup = pty_cleanup
>  };
>
> @@ -672,7 +664,6 @@ static const struct tty_operations pty_unix98_ops = {
>  	.chars_in_buffer = pty_chars_in_buffer,
>  	.unthrottle = pty_unthrottle,
>  	.set_termios = pty_set_termios,
> -	.shutdown = pty_unix98_shutdown,
>  	.cleanup = pty_cleanup,
>  };
>
>