public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH] TTY fixes for 2.6.32-git
@ 2009-11-18  1:00 Greg KH
  2009-11-18  1:01 ` [PATCH 1/2] tty_port: If we are opened non blocking we still need to raise the carrier Greg Kroah-Hartman
  2009-11-18  1:01 ` [PATCH 2/2] tty: cp210x: Fix carrier handling Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Greg KH @ 2009-11-18  1:00 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are 2 tty bugfixs for your kernel tree.  It fixes a regression that
showed up in 2.6.31 with the cp210x driver.

Please pull from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/

Both of these patches have been in the -next and -mm trees for a while.

Both patches will be sent to the linux-kernel mailing list, if anyone
wants to see it.

thanks,

greg k-h

------------

 drivers/char/tty_port.c     |    3 +++
 drivers/usb/serial/cp210x.c |   21 +++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

---------------

Alan Cox (2):
      tty_port: If we are opened non blocking we still need to raise the carrier
      tty: cp210x: Fix carrier handling


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

* [PATCH 1/2] tty_port: If we are opened non blocking we still need to raise the carrier
  2009-11-18  1:00 [GIT PATCH] TTY fixes for 2.6.32-git Greg KH
@ 2009-11-18  1:01 ` Greg Kroah-Hartman
  2009-11-18  1:01 ` [PATCH 2/2] tty: cp210x: Fix carrier handling Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2009-11-18  1:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox, stable, Greg Kroah-Hartman

From: Alan Cox <alan@linux.intel.com>

Original discussion:
http://thread.gmane.org/gmane.linux.usb.general/23217/focus=23248
or
http://marc.info/?l=linux-usb&m=125553790714133&w=2

The tty_port code inherited a bug common to various drivers it was based
upon. If the tty is opened O_NONBLOCK we do not wait for the carrier to be
raised but we must still raise our modem lines if appropriate.

(There is a second question here about whether we should do so if CLOCAL is
 set but that can wait)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Reported-by: Karl Hiramoto <karl@hiramoto.org>
Tested-by:  Karl Hiramoto <karl@hiramoto.org>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/char/tty_port.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index a4bbb28..2e8552d 100644
--- a/drivers/char/tty_port.c
+++ b/drivers/char/tty_port.c
@@ -221,6 +221,9 @@ int tty_port_block_til_ready(struct tty_port *port,
 	   the port has just hung up or is in another error state */
 	if ((filp->f_flags & O_NONBLOCK) ||
 			(tty->flags & (1 << TTY_IO_ERROR))) {
+		/* Indicate we are open */
+		if (tty->termios->c_cflag & CBAUD)
+			tty_port_raise_dtr_rts(port);
 		port->flags |= ASYNC_NORMAL_ACTIVE;
 		return 0;
 	}
-- 
1.6.4.2


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

* [PATCH 2/2] tty: cp210x: Fix carrier handling
  2009-11-18  1:00 [GIT PATCH] TTY fixes for 2.6.32-git Greg KH
  2009-11-18  1:01 ` [PATCH 1/2] tty_port: If we are opened non blocking we still need to raise the carrier Greg Kroah-Hartman
@ 2009-11-18  1:01 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2009-11-18  1:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox, stable, Greg Kroah-Hartman

From: Alan Cox <alan@linux.intel.com>

Original discussion:
http://thread.gmane.org/gmane.linux.usb.general/23217/focus=23248
or
http://marc.info/?l=linux-usb&m=125553790714133&w=2

9a68e39d4a701fb3be03cae9b462408664ebd205 broke carrier handling so that a
cp210x setup which needed the carrier lines set up (non CLOCAL) which did
not make a call which set the termios bits left the lines down even if
CLOCAL was not asserted.

Fix this not by reverting but by adding the proper dtr_rts and
carrier_raised methods. This both sets the modem lines properly and also
implements the correct blocking semantics for the port as required by
POSIX.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Reported-by: Karl Hiramoto <karl@hiramoto.org>
Tested-by:  Karl Hiramoto <karl@hiramoto.org>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/usb/serial/cp210x.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 698252a..bd254ec 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -50,6 +50,8 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *,
 static void cp210x_break_ctl(struct tty_struct *, int);
 static int cp210x_startup(struct usb_serial *);
 static void cp210x_disconnect(struct usb_serial *);
+static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
+static int cp210x_carrier_raised(struct usb_serial_port *p);
 
 static int debug;
 
@@ -143,6 +145,8 @@ static struct usb_serial_driver cp210x_device = {
 	.tiocmset		= cp210x_tiocmset,
 	.attach			= cp210x_startup,
 	.disconnect		= cp210x_disconnect,
+	.dtr_rts		= cp210x_dtr_rts,
+	.carrier_raised		= cp210x_carrier_raised
 };
 
 /* Config request types */
@@ -746,6 +750,14 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file,
 	return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
 }
 
+static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
+{
+	if (on)
+		cp210x_tiocmset_port(p, NULL,  TIOCM_DTR|TIOCM_RTS, 0);
+	else
+		cp210x_tiocmset_port(p, NULL,  0, TIOCM_DTR|TIOCM_RTS);
+}
+
 static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
 {
 	struct usb_serial_port *port = tty->driver_data;
@@ -768,6 +780,15 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
 	return result;
 }
 
+static int cp210x_carrier_raised(struct usb_serial_port *p)
+{
+	unsigned int control;
+	cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1);
+	if (control & CONTROL_DCD)
+		return 1;
+	return 0;
+}
+
 static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
 {
 	struct usb_serial_port *port = tty->driver_data;
-- 
1.6.4.2


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

* [GIT PATCH] TTY fixes for 2.6.32-git
@ 2009-12-01 17:43 Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-12-01 17:43 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are 3 tty bugfixs for your kernel tree.  One fixes a regression
from 2.6.30, one fixes a build error, and the last one adds a new device
id.

Please pull from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/

Both of these patches have been in the -next and -mm trees for a while.

Both patches will be sent to the linux-kernel mailing list, if anyone
wants to see it.

thanks,

greg k-h

------------

 drivers/char/tty_port.c       |    7 +++++--
 drivers/serial/bcm63xx_uart.c |    4 ++--
 drivers/serial/of_serial.c    |    1 +
 3 files changed, 8 insertions(+), 4 deletions(-)

---------------

Alan Cox (1):
      tty_port: handle the nonblocking open of a dead port corner case

Maxime Bizon (1):
      bcm63xx_uart: Fix serial driver compile breakage.

Michal Simek (1):
      tty/of_serial: add missing ns16550a id


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

end of thread, other threads:[~2009-12-01 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18  1:00 [GIT PATCH] TTY fixes for 2.6.32-git Greg KH
2009-11-18  1:01 ` [PATCH 1/2] tty_port: If we are opened non blocking we still need to raise the carrier Greg Kroah-Hartman
2009-11-18  1:01 ` [PATCH 2/2] tty: cp210x: Fix carrier handling Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2009-12-01 17:43 [GIT PATCH] TTY fixes for 2.6.32-git Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox