linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] TTY: provide tty_standard_install helper
@ 2012-01-30 20:14 Jiri Slaby
  2012-01-30 20:14 ` [PATCH 2/5] USB: serial, use tty_standard_install Jiri Slaby
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jiri Slaby @ 2012-01-30 20:14 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, alan, jirislaby, Havard Skinnemoen

There are currently many cut&paste copies of what
tty_driver_install_tty does when custom ->install method is not
provided. Let's get rid of the copies and create a helper with this
setup code.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Havard Skinnemoen <hskinnemoen@google.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/tty/tty_io.c |   30 +++++++++++++++---------------
 include/linux/tty.h  |    2 ++
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index fbcc140..44736f9 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1271,6 +1271,19 @@ int tty_init_termios(struct tty_struct *tty)
 }
 EXPORT_SYMBOL_GPL(tty_init_termios);
 
+int tty_standard_install(struct tty_driver *driver, struct tty_struct *tty)
+{
+	int ret = tty_init_termios(tty);
+	if (ret)
+		return ret;
+
+	tty_driver_kref_get(driver);
+	tty->count++;
+	driver->ttys[tty->index] = tty;
+	return 0;
+}
+EXPORT_SYMBOL_GPL(tty_standard_install);
+
 /**
  *	tty_driver_install_tty() - install a tty entry in the driver
  *	@driver: the driver for the tty
@@ -1286,21 +1299,8 @@ EXPORT_SYMBOL_GPL(tty_init_termios);
 static int tty_driver_install_tty(struct tty_driver *driver,
 						struct tty_struct *tty)
 {
-	int idx = tty->index;
-	int ret;
-
-	if (driver->ops->install) {
-		ret = driver->ops->install(driver, tty);
-		return ret;
-	}
-
-	if (tty_init_termios(tty) == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
-		driver->ttys[idx] = tty;
-		return 0;
-	}
-	return -ENOMEM;
+	return driver->ops->install ? driver->ops->install(driver, tty) :
+		tty_standard_install(driver, tty);
 }
 
 /**
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f801a85..653fc57 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -490,6 +490,8 @@ extern void deinitialize_tty_struct(struct tty_struct *tty);
 extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
 extern int tty_release(struct inode *inode, struct file *filp);
 extern int tty_init_termios(struct tty_struct *tty);
+extern int tty_standard_install(struct tty_driver *driver,
+		struct tty_struct *tty);
 
 extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
 extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
-- 
1.7.8.3



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] USB: serial, use tty_standard_install
  2012-01-30 20:14 [PATCH 1/5] TTY: provide tty_standard_install helper Jiri Slaby
@ 2012-01-30 20:14 ` Jiri Slaby
  2012-01-30 20:14 ` [PATCH 3/5] TTY: " Jiri Slaby
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2012-01-30 20:14 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, alan, jirislaby

But before that we need to reorder the calls so that we don't need to
lower the reference counts if usb_autopm_get_interface fails.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/usb/serial/usb-serial.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 611b206..1e30cc9 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -214,15 +214,14 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
 	if (!try_module_get(serial->type->driver.owner))
 		goto error_module_get;
 
-	/* perform the standard setup */
-	retval = tty_init_termios(tty);
-	if (retval)
-		goto error_init_termios;
-
 	retval = usb_autopm_get_interface(serial->interface);
 	if (retval)
 		goto error_get_interface;
 
+	retval = tty_standard_install(driver, tty);
+	if (retval)
+		goto error_init_termios;
+
 	mutex_unlock(&serial->disc_mutex);
 
 	/* allow the driver to update the settings */
@@ -231,14 +230,11 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
 
 	tty->driver_data = port;
 
-	/* Final install (we use the default method) */
-	tty_driver_kref_get(driver);
-	tty->count++;
-	driver->ttys[idx] = tty;
 	return retval;
 
- error_get_interface:
  error_init_termios:
+	usb_autopm_put_interface(serial->interface);
+ error_get_interface:
 	module_put(serial->type->driver.owner);
  error_module_get:
  error_no_port:
-- 
1.7.8.3



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/5] TTY: use tty_standard_install
  2012-01-30 20:14 [PATCH 1/5] TTY: provide tty_standard_install helper Jiri Slaby
  2012-01-30 20:14 ` [PATCH 2/5] USB: serial, use tty_standard_install Jiri Slaby
@ 2012-01-30 20:14 ` Jiri Slaby
  2012-01-30 20:37   ` Alan Cox
                     ` (2 more replies)
  2012-01-30 20:14 ` [PATCH 4/5] TTY: pty, remove superfluous ptm test Jiri Slaby
                   ` (2 subsequent siblings)
  4 siblings, 3 replies; 13+ messages in thread
From: Jiri Slaby @ 2012-01-30 20:14 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, alan, jirislaby

Use the helper in the rest of the tty drivers. This is a simple
replacement.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/isdn/capi/capi.c     |    9 +++------
 drivers/misc/pti.c           |    6 +-----
 drivers/mmc/card/sdio_uart.c |    9 +++------
 drivers/tty/nozomi.c         |    8 ++------
 4 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index e44933d..ca9261a 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1015,14 +1015,11 @@ capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 {
 	int idx = tty->index;
 	struct capiminor *mp = capiminor_get(idx);
-	int ret = tty_init_termios(tty);
+	int ret = tty_standard_install(tty);
 
-	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
+	if (ret == 0)
 		tty->driver_data = mp;
-		driver->ttys[idx] = tty;
-	} else
+	else
 		capiminor_put(mp);
 	return ret;
 }
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 0b56e3f..f05c646 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -481,13 +481,9 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 {
 	int idx = tty->index;
 	struct pti_tty *pti_tty_data;
-	int ret = tty_init_termios(tty);
+	int ret = tty_standard_install(tty);
 
 	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
-		driver->ttys[idx] = tty;
-
 		pti_tty_data = kmalloc(sizeof(struct pti_tty), GFP_KERNEL);
 		if (pti_tty_data == NULL)
 			return -ENOMEM;
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index 2c151e1..3206867 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -750,15 +750,12 @@ static int sdio_uart_install(struct tty_driver *driver, struct tty_struct *tty)
 {
 	int idx = tty->index;
 	struct sdio_uart_port *port = sdio_uart_port_get(idx);
-	int ret = tty_init_termios(tty);
+	int ret = tty_standard_install(tty);
 
-	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
+	if (ret == 0)
 		/* This is the ref sdio_uart_port get provided */
 		tty->driver_data = port;
-		driver->ttys[idx] = tty;
-	} else
+	else
 		sdio_uart_port_put(port);
 	return ret;
 }
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index fd347ff..51f8576 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1602,13 +1602,9 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty)
 	int ret;
 	if (!port || !dc || dc->state != NOZOMI_STATE_READY)
 		return -ENODEV;
-	ret = tty_init_termios(tty);
-	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
+	ret = tty_standard_install(tty);
+	if (ret == 0)
 		tty->driver_data = port;
-		driver->ttys[tty->index] = tty;
-	}
 	return ret;
 }
 
-- 
1.7.8.3



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/5] TTY: pty, remove superfluous ptm test
  2012-01-30 20:14 [PATCH 1/5] TTY: provide tty_standard_install helper Jiri Slaby
  2012-01-30 20:14 ` [PATCH 2/5] USB: serial, use tty_standard_install Jiri Slaby
  2012-01-30 20:14 ` [PATCH 3/5] TTY: " Jiri Slaby
@ 2012-01-30 20:14 ` Jiri Slaby
  2012-01-30 20:37   ` Alan Cox
  2012-01-30 20:14 ` [PATCH 5/5] TTY: get rid of BTM around devpts_* Jiri Slaby
  2012-01-30 20:36 ` [PATCH 1/5] TTY: provide tty_standard_install helper Alan Cox
  4 siblings, 1 reply; 13+ messages in thread
From: Jiri Slaby @ 2012-01-30 20:14 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, alan, jirislaby

The code looks like:
if (tty->driver->subtype == PTY_TYPE_MASTER) {
  ...
  if (tty->driver == ptm_driver)

But the second if is superfluous because only the ptm_driver is of
PTY_TYPE_MASTER subtype.

Also we can remove the #if now because devpts_pty_kill is defined as
an empty function for non-CONFIG_UNIX98_PTYS configs.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/pty.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index d505837..ddec9f3 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -54,10 +54,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 	wake_up_interruptible(&tty->link->write_wait);
 	if (tty->driver->subtype == PTY_TYPE_MASTER) {
 		set_bit(TTY_OTHER_CLOSED, &tty->flags);
-#ifdef CONFIG_UNIX98_PTYS
-		if (tty->driver == ptm_driver)
-			devpts_pty_kill(tty->link);
-#endif
+		devpts_pty_kill(tty->link);
 		tty_unlock();
 		tty_vhangup(tty->link);
 		tty_lock();
-- 
1.7.8.3



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/5] TTY: get rid of BTM around devpts_*
  2012-01-30 20:14 [PATCH 1/5] TTY: provide tty_standard_install helper Jiri Slaby
                   ` (2 preceding siblings ...)
  2012-01-30 20:14 ` [PATCH 4/5] TTY: pty, remove superfluous ptm test Jiri Slaby
@ 2012-01-30 20:14 ` Jiri Slaby
  2012-01-30 20:36 ` [PATCH 1/5] TTY: provide tty_standard_install helper Alan Cox
  4 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2012-01-30 20:14 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, alan, jirislaby

devpts operations are protected by inode mutexes and dentry
refcounting. There is no need to hold BTM.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/pty.c    |    6 ++----
 drivers/tty/tty_io.c |    2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index ddec9f3..39afd04 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -54,8 +54,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 	wake_up_interruptible(&tty->link->write_wait);
 	if (tty->driver->subtype == PTY_TYPE_MASTER) {
 		set_bit(TTY_OTHER_CLOSED, &tty->flags);
-		devpts_pty_kill(tty->link);
 		tty_unlock();
+		devpts_pty_kill(tty->link);
 		tty_vhangup(tty->link);
 		tty_lock();
 	}
@@ -613,9 +613,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
 		return retval;
 
 	/* find a device that is not in use. */
-	tty_lock();
 	index = devpts_new_index(inode);
-	tty_unlock();
 	if (index < 0) {
 		retval = index;
 		goto err_file;
@@ -650,8 +648,8 @@ err_release:
 	tty_release(inode, filp);
 	return retval;
 out:
-	devpts_kill_index(inode, index);
 	tty_unlock();
+	devpts_kill_index(inode, index);
 err_file:
 	tty_free_file(filp);
 	return retval;
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 44736f9..ea7ebe2 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1789,11 +1789,11 @@ int tty_release(struct inode *inode, struct file *filp)
 	 * the slots and preserving the termios structure.
 	 */
 	release_tty(tty, idx);
+	tty_unlock();
 
 	/* Make this pty number available for reallocation */
 	if (devpts)
 		devpts_kill_index(inode, idx);
-	tty_unlock();
 	return 0;
 }
 
-- 
1.7.8.3



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] TTY: provide tty_standard_install helper
  2012-01-30 20:14 [PATCH 1/5] TTY: provide tty_standard_install helper Jiri Slaby
                   ` (3 preceding siblings ...)
  2012-01-30 20:14 ` [PATCH 5/5] TTY: get rid of BTM around devpts_* Jiri Slaby
@ 2012-01-30 20:36 ` Alan Cox
  4 siblings, 0 replies; 13+ messages in thread
From: Alan Cox @ 2012-01-30 20:36 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-kernel, alan, jirislaby, Havard Skinnemoen

On Mon, 30 Jan 2012 21:14:28 +0100
Jiri Slaby <jslaby@suse.cz> wrote:

> There are currently many cut&paste copies of what
> tty_driver_install_tty does when custom ->install method is not
> provided. Let's get rid of the copies and create a helper with this
> setup code.

Acked-by: Alan Cox <alan@linux.intel.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] TTY: use tty_standard_install
  2012-01-30 20:14 ` [PATCH 3/5] TTY: " Jiri Slaby
@ 2012-01-30 20:37   ` Alan Cox
  2012-02-01  9:40   ` Jiri Slaby
  2012-02-02 23:05   ` Greg KH
  2 siblings, 0 replies; 13+ messages in thread
From: Alan Cox @ 2012-01-30 20:37 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-kernel, alan, jirislaby

On Mon, 30 Jan 2012 21:14:30 +0100
Jiri Slaby <jslaby@suse.cz> wrote:

> Use the helper in the rest of the tty drivers. This is a simple
> replacement.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Alan Cox <alan@linux.intel.com>

Acked-by: Alan Cox <alan@linux.intel.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] TTY: pty, remove superfluous ptm test
  2012-01-30 20:14 ` [PATCH 4/5] TTY: pty, remove superfluous ptm test Jiri Slaby
@ 2012-01-30 20:37   ` Alan Cox
  0 siblings, 0 replies; 13+ messages in thread
From: Alan Cox @ 2012-01-30 20:37 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-kernel, alan, jirislaby

On Mon, 30 Jan 2012 21:14:31 +0100
Jiri Slaby <jslaby@suse.cz> wrote:

> The code looks like:
> if (tty->driver->subtype == PTY_TYPE_MASTER) {
>   ...
>   if (tty->driver == ptm_driver)
> 
> But the second if is superfluous because only the ptm_driver is of
> PTY_TYPE_MASTER subtype.
> 
> Also we can remove the #if now because devpts_pty_kill is defined as
> an empty function for non-CONFIG_UNIX98_PTYS configs.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>

Acked-by: Alan Cox <alan@linux.intel.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] TTY: use tty_standard_install
  2012-01-30 20:14 ` [PATCH 3/5] TTY: " Jiri Slaby
  2012-01-30 20:37   ` Alan Cox
@ 2012-02-01  9:40   ` Jiri Slaby
  2012-02-01  9:52     ` Jiri Slaby
  2012-02-02 23:05   ` Greg KH
  2 siblings, 1 reply; 13+ messages in thread
From: Jiri Slaby @ 2012-02-01  9:40 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-kernel, alan

On 01/30/2012 09:14 PM, Jiri Slaby wrote:
> Use the helper in the rest of the tty drivers. This is a simple
> replacement.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Alan Cox <alan@linux.intel.com>
> ---
>  drivers/isdn/capi/capi.c     |    9 +++------
>  drivers/misc/pti.c           |    6 +-----
>  drivers/mmc/card/sdio_uart.c |    9 +++------
>  drivers/tty/nozomi.c         |    8 ++------
>  4 files changed, 9 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
> index e44933d..ca9261a 100644
> --- a/drivers/isdn/capi/capi.c
> +++ b/drivers/isdn/capi/capi.c
> @@ -1015,14 +1015,11 @@ capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty)
>  {
>  	int idx = tty->index;
>  	struct capiminor *mp = capiminor_get(idx);
> -	int ret = tty_init_termios(tty);
> +	int ret = tty_standard_install(tty);

Uh, what version of the patch did I send? tty_standard_install takes 2
arguments! I will post the correct one in a moment.

sorry,
-- 
js

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] TTY: use tty_standard_install
  2012-02-01  9:40   ` Jiri Slaby
@ 2012-02-01  9:52     ` Jiri Slaby
  0 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2012-02-01  9:52 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-kernel, alan

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

On 02/01/2012 10:40 AM, Jiri Slaby wrote:
> On 01/30/2012 09:14 PM, Jiri Slaby wrote:
>> Use the helper in the rest of the tty drivers. This is a simple
>> replacement.
>>
>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>> Cc: Greg Kroah-Hartman <gregkh@suse.de>
>> Cc: Alan Cox <alan@linux.intel.com>
>> ---
>>  drivers/isdn/capi/capi.c     |    9 +++------
>>  drivers/misc/pti.c           |    6 +-----
>>  drivers/mmc/card/sdio_uart.c |    9 +++------
>>  drivers/tty/nozomi.c         |    8 ++------
>>  4 files changed, 9 insertions(+), 23 deletions(-)
>>
>> diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
>> index e44933d..ca9261a 100644
>> --- a/drivers/isdn/capi/capi.c
>> +++ b/drivers/isdn/capi/capi.c
>> @@ -1015,14 +1015,11 @@ capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty)
>>  {
>>  	int idx = tty->index;
>>  	struct capiminor *mp = capiminor_get(idx);
>> -	int ret = tty_init_termios(tty);
>> +	int ret = tty_standard_install(tty);
> 
> Uh, what version of the patch did I send? tty_standard_install takes 2
> arguments! I will post the correct one in a moment.

If my ISP's smtp server actually worked now. The patch is attached,
hopefully my mailer won't screw it.

thanks,
-- 
js

[-- Attachment #2: 0003-TTY-use-tty_standard_install.patch --]
[-- Type: text/x-patch, Size: 3139 bytes --]

>From fa0824d0cc22bafe62137b2b33998c8d55ce2ac5 Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Wed, 23 Nov 2011 22:31:01 +0100
Subject: [PATCH v2 3/5] TTY: use tty_standard_install

Use the helper in the rest of the tty drivers. This is a simple
replacement.

[v2] with correct number of parameters...

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@linux.intel.com>
---
 drivers/isdn/capi/capi.c     |    9 +++------
 drivers/misc/pti.c           |    6 +-----
 drivers/mmc/card/sdio_uart.c |    9 +++------
 drivers/tty/nozomi.c         |    8 ++------
 4 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index e44933d..94948be 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1015,14 +1015,11 @@ capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 {
 	int idx = tty->index;
 	struct capiminor *mp = capiminor_get(idx);
-	int ret = tty_init_termios(tty);
+	int ret = tty_standard_install(driver, tty);
 
-	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
+	if (ret == 0)
 		tty->driver_data = mp;
-		driver->ttys[idx] = tty;
-	} else
+	else
 		capiminor_put(mp);
 	return ret;
 }
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 0b56e3f..471ff4c 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -481,13 +481,9 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 {
 	int idx = tty->index;
 	struct pti_tty *pti_tty_data;
-	int ret = tty_init_termios(tty);
+	int ret = tty_standard_install(driver, tty);
 
 	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
-		driver->ttys[idx] = tty;
-
 		pti_tty_data = kmalloc(sizeof(struct pti_tty), GFP_KERNEL);
 		if (pti_tty_data == NULL)
 			return -ENOMEM;
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index 2c151e1..bd4a67c 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -750,15 +750,12 @@ static int sdio_uart_install(struct tty_driver *driver, struct tty_struct *tty)
 {
 	int idx = tty->index;
 	struct sdio_uart_port *port = sdio_uart_port_get(idx);
-	int ret = tty_init_termios(tty);
+	int ret = tty_standard_install(driver, tty);
 
-	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
+	if (ret == 0)
 		/* This is the ref sdio_uart_port get provided */
 		tty->driver_data = port;
-		driver->ttys[idx] = tty;
-	} else
+	else
 		sdio_uart_port_put(port);
 	return ret;
 }
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index fd347ff..580da78 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1602,13 +1602,9 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty)
 	int ret;
 	if (!port || !dc || dc->state != NOZOMI_STATE_READY)
 		return -ENODEV;
-	ret = tty_init_termios(tty);
-	if (ret == 0) {
-		tty_driver_kref_get(driver);
-		tty->count++;
+	ret = tty_standard_install(driver, tty);
+	if (ret == 0)
 		tty->driver_data = port;
-		driver->ttys[tty->index] = tty;
-	}
 	return ret;
 }
 
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] TTY: use tty_standard_install
  2012-01-30 20:14 ` [PATCH 3/5] TTY: " Jiri Slaby
  2012-01-30 20:37   ` Alan Cox
  2012-02-01  9:40   ` Jiri Slaby
@ 2012-02-02 23:05   ` Greg KH
  2012-02-02 23:23     ` Jiri Slaby
  2 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2012-02-02 23:05 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: gregkh, linux-kernel, alan, jirislaby

On Mon, Jan 30, 2012 at 09:14:30PM +0100, Jiri Slaby wrote:
> Use the helper in the rest of the tty drivers. This is a simple
> replacement.

It would be, if you actually built this patch, as it is, it breaks :(

> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Acked-by: Alan Cox <alan@linux.intel.com>
> ---
>  drivers/isdn/capi/capi.c     |    9 +++------
>  drivers/misc/pti.c           |    6 +-----
>  drivers/mmc/card/sdio_uart.c |    9 +++------
>  drivers/tty/nozomi.c         |    8 ++------
>  4 files changed, 9 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
> index e44933d..ca9261a 100644
> --- a/drivers/isdn/capi/capi.c
> +++ b/drivers/isdn/capi/capi.c
> @@ -1015,14 +1015,11 @@ capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty)
>  {
>  	int idx = tty->index;
>  	struct capiminor *mp = capiminor_get(idx);
> -	int ret = tty_init_termios(tty);
> +	int ret = tty_standard_install(tty);

This, and, all of the other calls in this patch, should be (driver, tty)
for the function arguments, right?

That seems to fix the build for me, so I've checked it in, but please
verify that I got it right.

greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] TTY: use tty_standard_install
  2012-02-02 23:05   ` Greg KH
@ 2012-02-02 23:23     ` Jiri Slaby
  2012-02-02 23:49       ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Jiri Slaby @ 2012-02-02 23:23 UTC (permalink / raw)
  To: Greg KH; +Cc: Jiri Slaby, gregkh, linux-kernel, alan

On 02/03/2012 12:05 AM, Greg KH wrote:
> On Mon, Jan 30, 2012 at 09:14:30PM +0100, Jiri Slaby wrote:
>> Use the helper in the rest of the tty drivers. This is a simple
>> replacement.
> 
> It would be, if you actually built this patch, as it is, it breaks :(

Yes, I replied to this patch that I sent you some broken bastard. Also I
attached the correct version...

>> --- a/drivers/isdn/capi/capi.c
>> +++ b/drivers/isdn/capi/capi.c
>> @@ -1015,14 +1015,11 @@ capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty)
>>  {
>>  	int idx = tty->index;
>>  	struct capiminor *mp = capiminor_get(idx);
>> -	int ret = tty_init_termios(tty);
>> +	int ret = tty_standard_install(tty);
> 
> This, and, all of the other calls in this patch, should be (driver, tty)
> for the function arguments, right?
> 
> That seems to fix the build for me, so I've checked it in, but please
> verify that I got it right.

It is OK.

Sorry for that.

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] TTY: use tty_standard_install
  2012-02-02 23:23     ` Jiri Slaby
@ 2012-02-02 23:49       ` Greg KH
  0 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2012-02-02 23:49 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Jiri Slaby, gregkh, linux-kernel, alan

On Fri, Feb 03, 2012 at 12:23:36AM +0100, Jiri Slaby wrote:
> On 02/03/2012 12:05 AM, Greg KH wrote:
> > On Mon, Jan 30, 2012 at 09:14:30PM +0100, Jiri Slaby wrote:
> >> Use the helper in the rest of the tty drivers. This is a simple
> >> replacement.
> > 
> > It would be, if you actually built this patch, as it is, it breaks :(
> 
> Yes, I replied to this patch that I sent you some broken bastard. Also I
> attached the correct version...

Odd, I missed that somehow, sorry about that.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-02-02 23:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-30 20:14 [PATCH 1/5] TTY: provide tty_standard_install helper Jiri Slaby
2012-01-30 20:14 ` [PATCH 2/5] USB: serial, use tty_standard_install Jiri Slaby
2012-01-30 20:14 ` [PATCH 3/5] TTY: " Jiri Slaby
2012-01-30 20:37   ` Alan Cox
2012-02-01  9:40   ` Jiri Slaby
2012-02-01  9:52     ` Jiri Slaby
2012-02-02 23:05   ` Greg KH
2012-02-02 23:23     ` Jiri Slaby
2012-02-02 23:49       ` Greg KH
2012-01-30 20:14 ` [PATCH 4/5] TTY: pty, remove superfluous ptm test Jiri Slaby
2012-01-30 20:37   ` Alan Cox
2012-01-30 20:14 ` [PATCH 5/5] TTY: get rid of BTM around devpts_* Jiri Slaby
2012-01-30 20:36 ` [PATCH 1/5] TTY: provide tty_standard_install helper Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).