All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH] TTY/serial driver fixes for 3.1
@ 2011-08-26 19:11 Greg KH
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2011-08-26 19:11 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, linux-serial

Here are some small tty/serial fixes for the 3.1 release.

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

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

Patches will be sent to the linux-serial mailing list, if anyone wants
to see them.

thanks,

greg k-h

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

 drivers/tty/pty.c                 |   17 +++++++++++++++--
 drivers/tty/serial/8250.c         |    8 +++++---
 drivers/tty/serial/8250_pci.c     |   11 +++++------
 drivers/tty/serial/8250_pnp.c     |    3 +++
 drivers/tty/serial/atmel_serial.c |    8 +++++---
 drivers/tty/serial/max3107-aava.c |    2 +-
 drivers/tty/serial/max3107.c      |    2 +-
 drivers/tty/serial/mrst_max3110.c |    2 +-
 drivers/tty/serial/omap-serial.c  |    3 +--
 drivers/tty/serial/pch_uart.c     |    3 ++-
 drivers/tty/serial/samsung.c      |    8 ++++++--
 drivers/tty/serial/serial_core.c  |    5 +++++
 drivers/tty/serial/ucc_uart.c     |    2 +-
 drivers/tty/tty_io.c              |    3 +--
 include/linux/tty.h               |    2 ++
 include/linux/tty_driver.h        |    3 +++
 16 files changed, 57 insertions(+), 25 deletions(-)

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

Al Cooper (1):
      8250: Fix race condition in serial8250_backup_timeout().

Axel Lin (1):
      tty: Add "spi:" prefix for spi modalias

Bjorn Helgaas (1):
      serial: 8250_pnp: add Intermec CV60 touchscreen device

Eric Smith (1):
      8250_pci: add support for Rosewill RC-305 4x serial port card

Jiri Slaby (2):
      TTY: pty, fix pty counting
      TTY: serial, document ignoring of uart->ops->startup error

Kukjin Kim (1):
      serial: samsung: Fix build error

Kumar Gala (1):
      drivers/serial/ucc_uart.c: Fix compiler warning

Nick Pelly (1):
      omap-serial: Allow IXON and IXOFF to be disabled.

Tomoya MORINAGA (2):
      pch_uart: Set PCIe bus number using probe parameter
      serial/8250_pci: delete duplicate data definition

Voss, Nikolaus (1):
      atmel_serial: fix atmel_default_console_device


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

* [PATCH 01/12] serial: samsung: Fix build error
  2011-08-26 19:11 [GIT PATCH] TTY/serial driver fixes for 3.1 Greg KH
@ 2011-08-26 20:58 ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 02/12] pch_uart: Set PCIe bus number using probe parameter Greg Kroah-Hartman
                     ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Kukjin Kim, Greg Kroah-Hartman

From: Kukjin Kim <kgene.kim@samsung.com>

drivers/tty/serial/samsung.c: In function 's3c24xx_serial_init':
drivers/tty/serial/samsung.c:1237: error: lvalue required as unary '&' operand

Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/samsung.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index afc6294..6edafb5 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1225,15 +1225,19 @@ static const struct dev_pm_ops s3c24xx_serial_pm_ops = {
 	.suspend = s3c24xx_serial_suspend,
 	.resume = s3c24xx_serial_resume,
 };
+#define SERIAL_SAMSUNG_PM_OPS	(&s3c24xx_serial_pm_ops)
+
 #else /* !CONFIG_PM_SLEEP */
-#define s3c24xx_serial_pm_ops	NULL
+
+#define SERIAL_SAMSUNG_PM_OPS	NULL
 #endif /* CONFIG_PM_SLEEP */
 
 int s3c24xx_serial_init(struct platform_driver *drv,
 			struct s3c24xx_uart_info *info)
 {
 	dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
-	drv->driver.pm = &s3c24xx_serial_pm_ops;
+
+	drv->driver.pm = SERIAL_SAMSUNG_PM_OPS;
 
 	return platform_driver_register(drv);
 }
-- 
1.7.6.1


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

* [PATCH 02/12] pch_uart: Set PCIe bus number using probe parameter
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 03/12] drivers/serial/ucc_uart.c: Fix compiler warning Greg Kroah-Hartman
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Tomoya MORINAGA, Greg Kroah-Hartman

From: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>

Currently, PCIe bus number is set as fixed value "2".
However, PCIe bus number is not always "2".
This patch sets bus number using probe() parameter.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/pch_uart.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 846dfcd..b46218d 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -598,7 +598,8 @@ static void pch_request_dma(struct uart_port *port)
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	dma_dev = pci_get_bus_and_slot(2, PCI_DEVFN(0xa, 0)); /* Get DMA's dev
+	dma_dev = pci_get_bus_and_slot(priv->pdev->bus->number,
+				       PCI_DEVFN(0xa, 0)); /* Get DMA's dev
 								information */
 	/* Set Tx DMA */
 	param = &priv->param_tx;
-- 
1.7.6.1


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

* [PATCH 03/12] drivers/serial/ucc_uart.c: Fix compiler warning
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 02/12] pch_uart: Set PCIe bus number using probe parameter Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 04/12] serial: 8250_pnp: add Intermec CV60 touchscreen device Greg Kroah-Hartman
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Kumar Gala, Greg Kroah-Hartman

From: Kumar Gala <galak@kernel.crashing.org>

drivers/tty/serial/ucc_uart.c: In function 'qe2cpu_addr':
drivers/tty/serial/ucc_uart.c:238:2: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'dma_addr_t'

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/ucc_uart.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index c327218..9af9f08 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -235,7 +235,7 @@ static inline void *qe2cpu_addr(dma_addr_t addr, struct uart_qe_port *qe_port)
 		return qe_port->bd_virt + (addr - qe_port->bd_dma_addr);
 
 	/* something nasty happened */
-	printk(KERN_ERR "%s: addr=%x\n", __func__, addr);
+	printk(KERN_ERR "%s: addr=%llx\n", __func__, (u64)addr);
 	BUG();
 	return NULL;
 }
-- 
1.7.6.1


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

* [PATCH 04/12] serial: 8250_pnp: add Intermec CV60 touchscreen device
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 02/12] pch_uart: Set PCIe bus number using probe parameter Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 03/12] drivers/serial/ucc_uart.c: Fix compiler warning Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 05/12] atmel_serial: fix atmel_default_console_device Greg Kroah-Hartman
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Bjorn Helgaas, Jeff Chua, stable, Greg Kroah-Hartman

From: Bjorn Helgaas <bhelgaas@google.com>

It would have been nice if Intermec had supplied a PNP0501 _CID for the
COM3 device, but they didn't, so we have to recognize it explicitly.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=40612
CC: Jeff Chua <jeff.chua.linux@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable <stable@kernel.org>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/8250_pnp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250_pnp.c b/drivers/tty/serial/8250_pnp.c
index fc301f6..a2f2365 100644
--- a/drivers/tty/serial/8250_pnp.c
+++ b/drivers/tty/serial/8250_pnp.c
@@ -109,6 +109,9 @@ static const struct pnp_device_id pnp_dev_table[] = {
 	/* IBM */
 	/* IBM Thinkpad 701 Internal Modem Voice */
 	{	"IBM0033",		0	},
+	/* Intermec */
+	/* Intermec CV60 touchscreen port */
+	{	"PNP4972",		0	},
 	/* Intertex */
 	/* Intertex 28k8 33k6 Voice EXT PnP */
 	{	"IXDC801",		0	},
-- 
1.7.6.1


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

* [PATCH 05/12] atmel_serial: fix atmel_default_console_device
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (2 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 04/12] serial: 8250_pnp: add Intermec CV60 touchscreen device Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 06/12] tty: Add "spi:" prefix for spi modalias Greg Kroah-Hartman
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Voss, Nikolaus, Nikolaus Voss, Greg Kroah-Hartman

From: "Voss, Nikolaus" <N.Voss@weinmann.de>

reflect new static uart platform ids introduced by patch
http://article.gmane.org/gmane.linux.kernel/1126105

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/atmel_serial.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index af9b781..b922f5d 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1609,9 +1609,11 @@ static struct console atmel_console = {
 static int __init atmel_console_init(void)
 {
 	if (atmel_default_console_device) {
-		add_preferred_console(ATMEL_DEVICENAME,
-				      atmel_default_console_device->id, NULL);
-		atmel_init_port(&atmel_ports[atmel_default_console_device->id],
+		struct atmel_uart_data *pdata =
+			atmel_default_console_device->dev.platform_data;
+
+		add_preferred_console(ATMEL_DEVICENAME, pdata->num, NULL);
+		atmel_init_port(&atmel_ports[pdata->num],
 				atmel_default_console_device);
 		register_console(&atmel_console);
 	}
-- 
1.7.6.1


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

* [PATCH 06/12] tty: Add "spi:" prefix for spi modalias
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (3 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 05/12] atmel_serial: fix atmel_default_console_device Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 07/12] 8250_pci: add support for Rosewill RC-305 4x serial port card Greg Kroah-Hartman
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Axel Lin, stable, Greg Kroah-Hartman

From: Axel Lin <axel.lin@gmail.com>

Since commit e0626e38 (spi: prefix modalias with "spi:"),
the spi modalias is prefixed with "spi:".

This patch adds "spi:" prefix and removes "-spi" suffix in the modalias.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/max3107-aava.c |    2 +-
 drivers/tty/serial/max3107.c      |    2 +-
 drivers/tty/serial/mrst_max3110.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/max3107-aava.c b/drivers/tty/serial/max3107-aava.c
index a1fe304..d73aadd 100644
--- a/drivers/tty/serial/max3107-aava.c
+++ b/drivers/tty/serial/max3107-aava.c
@@ -340,5 +340,5 @@ module_exit(max3107_exit);
 
 MODULE_DESCRIPTION("MAX3107 driver");
 MODULE_AUTHOR("Aavamobile");
-MODULE_ALIAS("aava-max3107-spi");
+MODULE_ALIAS("spi:aava-max3107");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/tty/serial/max3107.c b/drivers/tty/serial/max3107.c
index 750b4f6..a816460 100644
--- a/drivers/tty/serial/max3107.c
+++ b/drivers/tty/serial/max3107.c
@@ -1209,5 +1209,5 @@ module_exit(max3107_exit);
 
 MODULE_DESCRIPTION("MAX3107 driver");
 MODULE_AUTHOR("Aavamobile");
-MODULE_ALIAS("max3107-spi");
+MODULE_ALIAS("spi:max3107");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index a764bf9..23bc743 100644
--- a/drivers/tty/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
@@ -917,4 +917,4 @@ module_init(serial_m3110_init);
 module_exit(serial_m3110_exit);
 
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("max3110-uart");
+MODULE_ALIAS("spi:max3110-uart");
-- 
1.7.6.1


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

* [PATCH 07/12] 8250_pci: add support for Rosewill RC-305 4x serial port card
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (4 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 06/12] tty: Add "spi:" prefix for spi modalias Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 08/12] serial/8250_pci: delete duplicate data definition Greg Kroah-Hartman
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Eric Smith, stable, Greg Kroah-Hartman

From: Eric Smith <eric@brouhaha.com>

This patch adds support for the Rosewill RC-305 four-port PCI serial
card, and probably any other four-port serial cards based on the
Moschip MCS9865 chip, assuming that the EEPROM on the card was
programmed in accordance with Table 6 of the MCS9865 EEPROM
Application Note version 0.3 dated 16-May-2008, available from the
Moschip web site (registration required).

This patch is based on an earlier patch [1] for the SYBA 6x serial
port card by Ira W. Snyder.

[1]: http://www.gossamer-threads.com/lists/linux/kernel/1162435

Signed-off-by: Eric Smith <eric@brouhaha.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/8250_pci.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index 6b887d9..f652a7b 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -4021,7 +4021,7 @@ static struct pci_device_id serial_pci_tbl[] = {
 		0, 0, pbn_NETMOS9900_2s_115200 },
 
 	/*
-	 * Best Connectivity PCI Multi I/O cards
+	 * Best Connectivity and Rosewill PCI Multi I/O cards
 	 */
 
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
@@ -4029,6 +4029,10 @@ static struct pci_device_id serial_pci_tbl[] = {
 		0, 0, pbn_b0_1_115200 },
 
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
+		0xA000, 0x3002,
+		0, 0, pbn_b0_bt_2_115200 },
+
+	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865,
 		0xA000, 0x3004,
 		0, 0, pbn_b0_bt_4_115200 },
 	/* Intel CE4100 */
-- 
1.7.6.1


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

* [PATCH 08/12] serial/8250_pci: delete duplicate data definition
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (5 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 07/12] 8250_pci: add support for Rosewill RC-305 4x serial port card Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 09/12] 8250: Fix race condition in serial8250_backup_timeout() Greg Kroah-Hartman
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Tomoya MORINAGA, Greg Kroah-Hartman

From: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>

Data definiton "VendorID=10DB, device_id=800D" is already defined.
This patch deletes the duplicate definition.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/8250_pci.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index f652a7b..3abeca2 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -1599,11 +1599,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.device         = 0x800D,
 		.init		= pci_eg20t_init,
 	},
-	{
-		.vendor         = 0x10DB,
-		.device         = 0x800D,
-		.init		= pci_eg20t_init,
-	},
 	/*
 	 * Cronyx Omega PCI (PLX-chip based)
 	 */
-- 
1.7.6.1


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

* [PATCH 09/12] 8250: Fix race condition in serial8250_backup_timeout().
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (6 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 08/12] serial/8250_pci: delete duplicate data definition Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 10/12] TTY: pty, fix pty counting Greg Kroah-Hartman
                     ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Al Cooper, stable, Greg Kroah-Hartman

From: Al Cooper <alcooperx@gmail.com>

This is to fix an issue where output will suddenly become very slow.
The problem occurs on 8250 UARTS with the hardware bug UART_BUG_THRE.

BACKGROUND
For normal UARTs (without UART_BUG_THRE): When the serial core layer
gets new transmit data and the transmitter is idle, it buffers the
data and calls the 8250s' serial8250_start_tx() routine which will
simply enable the TX interrupt in the IER register and return. This
should immediately fire a THRE interrupt and begin transmitting the
data.
For buggy UARTs (with UART_BUG_THRE): merely enabling the TX interrupt
in IER does not necessarily generate a new THRE interrupt.
Therefore, a background timer periodically checks to see if there is
pending data, and starts transmission if that is the case.

The bug happens on SMP systems when the system has nothing to transmit,
the transmit interrupt is disabled and the following sequence occurs:
- CPU0: The background timer routine serial8250_backup_timeout()
  starts and saves the state of the interrupt enable register (IER)
  and then disables all interrupts in IER. NOTE: The transmit interrupt
  (TI) bit is saved as disabled.
- CPU1: The serial core gets data to transmit, grabs the port lock and
  calls serial8250_start_tx() which enables the TI in IER.
- CPU0: serial8250_backup_timeout() waits for the port lock.
- CPU1: finishes (with TI enabled) and releases the port lock.
- CPU0: serial8250_backup_timeout() calls the interrupt routine which
  will transmit the next fifo's worth of data and then restores the
  IER from the previously saved value (TI disabled).
At this point, as long as the serial core has more transmit data
buffered, it will not call serial8250_start_tx() again and the
background timer routine will slowly transmit the data.

The fix is to have serial8250_start_tx() get the port lock before
it saves the IER state and release it after restoring IER. This will
prevent serial8250_start_tx() from running in parallel.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/8250.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index f2dfec8..7f50999 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -1819,6 +1819,8 @@ static void serial8250_backup_timeout(unsigned long data)
 	unsigned int iir, ier = 0, lsr;
 	unsigned long flags;
 
+	spin_lock_irqsave(&up->port.lock, flags);
+
 	/*
 	 * Must disable interrupts or else we risk racing with the interrupt
 	 * based handler.
@@ -1836,10 +1838,8 @@ static void serial8250_backup_timeout(unsigned long data)
 	 * the "Diva" UART used on the management processor on many HP
 	 * ia64 and parisc boxes.
 	 */
-	spin_lock_irqsave(&up->port.lock, flags);
 	lsr = serial_in(up, UART_LSR);
 	up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
-	spin_unlock_irqrestore(&up->port.lock, flags);
 	if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) &&
 	    (!uart_circ_empty(&up->port.state->xmit) || up->port.x_char) &&
 	    (lsr & UART_LSR_THRE)) {
@@ -1848,11 +1848,13 @@ static void serial8250_backup_timeout(unsigned long data)
 	}
 
 	if (!(iir & UART_IIR_NO_INT))
-		serial8250_handle_port(up);
+		transmit_chars(up);
 
 	if (is_real_interrupt(up->port.irq))
 		serial_out(up, UART_IER, ier);
 
+	spin_unlock_irqrestore(&up->port.lock, flags);
+
 	/* Standard timer interval plus 0.2s to keep the port running */
 	mod_timer(&up->timer,
 		jiffies + uart_poll_timeout(&up->port) + HZ / 5);
-- 
1.7.6.1


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

* [PATCH 10/12] TTY: pty, fix pty counting
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (7 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 09/12] 8250: Fix race condition in serial8250_backup_timeout() Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 11/12] TTY: serial, document ignoring of uart->ops->startup error Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 12/12] omap-serial: Allow IXON and IXOFF to be disabled Greg Kroah-Hartman
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial
  Cc: Jiri Slaby, Alan Cox, H. Peter Anvin, stable, Greg Kroah-Hartman

From: Jiri Slaby <jslaby@suse.cz>

tty_operations->remove is normally called like:
queue_release_one_tty
 ->tty_shutdown
   ->tty_driver_remove_tty
     ->tty_operations->remove

However tty_shutdown() is called from queue_release_one_tty() only if
tty_operations->shutdown is NULL. But for pty, it is not.
pty_unix98_shutdown() is used there as ->shutdown.

So tty_operations->remove of pty (i.e. pty_unix98_remove()) is never
called. This results in invalid pty_count. I.e. what can be seen in
/proc/sys/kernel/pty/nr.

I see this was already reported at:
  https://lkml.org/lkml/2009/11/5/370
But it was not fixed since then.

This patch is kind of a hackish way. The problem lies in ->install. We
allocate there another tty (so-called tty->link). So ->install is
called once, but ->remove twice, for both tty and tty->link. The fix
here is to count both tty and tty->link and divide the count by 2 for
user.

And to have ->remove called, let's make tty_driver_remove_tty() global
and call that from pty_unix98_shutdown() (tty_operations->shutdown).

While at it, let's document that when ->shutdown is defined,
tty_shutdown() is not called.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/pty.c          |   17 +++++++++++++++--
 drivers/tty/tty_io.c       |    3 +--
 include/linux/tty.h        |    2 ++
 include/linux/tty_driver.h |    3 +++
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 98b6e3b..e809e9d 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -446,8 +446,19 @@ static inline void legacy_pty_init(void) { }
 int pty_limit = NR_UNIX98_PTY_DEFAULT;
 static int pty_limit_min;
 static int pty_limit_max = NR_UNIX98_PTY_MAX;
+static int tty_count;
 static int pty_count;
 
+static inline void pty_inc_count(void)
+{
+	pty_count = (++tty_count) / 2;
+}
+
+static inline void pty_dec_count(void)
+{
+	pty_count = (--tty_count) / 2;
+}
+
 static struct cdev ptmx_cdev;
 
 static struct ctl_table pty_table[] = {
@@ -542,6 +553,7 @@ static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver,
 
 static void pty_unix98_shutdown(struct tty_struct *tty)
 {
+	tty_driver_remove_tty(tty->driver, tty);
 	/* We have our own method as we don't use the tty index */
 	kfree(tty->termios);
 }
@@ -588,7 +600,8 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty)
 	 */
 	tty_driver_kref_get(driver);
 	tty->count++;
-	pty_count++;
+	pty_inc_count(); /* tty */
+	pty_inc_count(); /* tty->link */
 	return 0;
 err_free_mem:
 	deinitialize_tty_struct(o_tty);
@@ -602,7 +615,7 @@ err_free_tty:
 
 static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
 {
-	pty_count--;
+	pty_dec_count();
 }
 
 static const struct tty_operations ptm_unix98_ops = {
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 150e4f7..4f1fc81 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1295,8 +1295,7 @@ static int tty_driver_install_tty(struct tty_driver *driver,
  *
  *	Locking: tty_mutex for now
  */
-static void tty_driver_remove_tty(struct tty_driver *driver,
-						struct tty_struct *tty)
+void tty_driver_remove_tty(struct tty_driver *driver, struct tty_struct *tty)
 {
 	if (driver->ops->remove)
 		driver->ops->remove(driver, tty);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 44bc0c5..5f2ede8 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -421,6 +421,8 @@ extern void tty_driver_flush_buffer(struct tty_struct *tty);
 extern void tty_throttle(struct tty_struct *tty);
 extern void tty_unthrottle(struct tty_struct *tty);
 extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
+extern void tty_driver_remove_tty(struct tty_driver *driver,
+				  struct tty_struct *tty);
 extern void tty_shutdown(struct tty_struct *tty);
 extern void tty_free_termios(struct tty_struct *tty);
 extern int is_current_pgrp_orphaned(void);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 9deeac8..ecdaeb9 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -47,6 +47,9 @@
  *
  * 	This routine is called synchronously when a particular tty device
  *	is closed for the last time freeing up the resources.
+ *	Note that tty_shutdown() is not called if ops->shutdown is defined.
+ *	This means one is responsible to take care of calling ops->remove (e.g.
+ *	via tty_driver_remove_tty) and releasing tty->termios.
  *
  *
  * void (*cleanup)(struct tty_struct * tty);
-- 
1.7.6.1


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

* [PATCH 11/12] TTY: serial, document ignoring of uart->ops->startup error
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (8 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 10/12] TTY: pty, fix pty counting Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  2011-08-26 20:58   ` [PATCH 12/12] omap-serial: Allow IXON and IXOFF to be disabled Greg Kroah-Hartman
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Jiri Slaby, Alan Cox, Russel King, Greg Kroah-Hartman

From: Jiri Slaby <jslaby@suse.cz>

When a user has SYS_ADMIN capabilities and uart->ops->startup returns
an error in uart_startup, we silently drop the error. We then return 0
and behave as if it didn't fail. (Not quite, since we set TTY_IO_ERROR
bit and leave ASYNC_INITIALIZED bit cleared.)

This all is to allow setserial to work with improperly configured or
unconfigured ports. User can thus set port properties and reconfigure
properly.

This patch only documents this behavior.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Russel King <linux@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/serial_core.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index db7912c..a3efbea 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -200,6 +200,11 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state, int in
 		clear_bit(TTY_IO_ERROR, &tty->flags);
 	}
 
+	/*
+	 * This is to allow setserial on this port. People may want to set
+	 * port/irq/type and then reconfigure the port properly if it failed
+	 * now.
+	 */
 	if (retval && capable(CAP_SYS_ADMIN))
 		retval = 0;
 
-- 
1.7.6.1


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

* [PATCH 12/12] omap-serial: Allow IXON and IXOFF to be disabled.
  2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
                     ` (9 preceding siblings ...)
  2011-08-26 20:58   ` [PATCH 11/12] TTY: serial, document ignoring of uart->ops->startup error Greg Kroah-Hartman
@ 2011-08-26 20:58   ` Greg Kroah-Hartman
  10 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2011-08-26 20:58 UTC (permalink / raw)
  To: linux-serial; +Cc: Nick Pelly, stable, Greg Kroah-Hartman

From: Nick Pelly <npelly@google.com>

Fixes logic bug that software flow control cannot be disabled, because
serial_omap_configure_xonxoff() is not called if both IXON and IXOFF bits
are cleared.

Signed-off-by: Nick Pelly <npelly@google.com>
Acked-by: Govindraj.R <govindraj.raja@ti.com>
Tested-by: Govindraj.R <govindraj.raja@ti.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/tty/serial/omap-serial.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index c37df8d..5e713d3 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -806,8 +806,7 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	serial_omap_set_mctrl(&up->port, up->port.mctrl);
 	/* Software Flow Control Configuration */
-	if (termios->c_iflag & (IXON | IXOFF))
-		serial_omap_configure_xonxoff(up, termios);
+	serial_omap_configure_xonxoff(up, termios);
 
 	spin_unlock_irqrestore(&up->port.lock, flags);
 	dev_dbg(up->port.dev, "serial_omap_set_termios+%d\n", up->pdev->id);
-- 
1.7.6.1


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

end of thread, other threads:[~2011-08-26 20:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26 19:11 [GIT PATCH] TTY/serial driver fixes for 3.1 Greg KH
2011-08-26 20:58 ` [PATCH 01/12] serial: samsung: Fix build error Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 02/12] pch_uart: Set PCIe bus number using probe parameter Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 03/12] drivers/serial/ucc_uart.c: Fix compiler warning Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 04/12] serial: 8250_pnp: add Intermec CV60 touchscreen device Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 05/12] atmel_serial: fix atmel_default_console_device Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 06/12] tty: Add "spi:" prefix for spi modalias Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 07/12] 8250_pci: add support for Rosewill RC-305 4x serial port card Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 08/12] serial/8250_pci: delete duplicate data definition Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 09/12] 8250: Fix race condition in serial8250_backup_timeout() Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 10/12] TTY: pty, fix pty counting Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 11/12] TTY: serial, document ignoring of uart->ops->startup error Greg Kroah-Hartman
2011-08-26 20:58   ` [PATCH 12/12] omap-serial: Allow IXON and IXOFF to be disabled Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.