From: Alan Cox <alan@lxorguk.ukuu.org.uk>

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/char/Kconfig        |    4 ++--
 drivers/char/hvc_console.c  |    4 ++--
 drivers/char/hvcs.c         |   10 ++++------
 drivers/usb/class/bluetty.c |   17 ++---------------
 drivers/usb/serial/Kconfig  |    2 +-
 5 files changed, 11 insertions(+), 26 deletions(-)

diff -puN drivers/char/hvc_console.c~tty-layer-buffering-revamp-further-tty-bits drivers/char/hvc_console.c
--- devel/drivers/char/hvc_console.c~tty-layer-buffering-revamp-further-tty-bits	2005-09-13 18:24:45.000000000 -0700
+++ devel-akpm/drivers/char/hvc_console.c	2005-09-13 18:24:45.000000000 -0700
@@ -597,7 +597,7 @@ static int hvc_poll(struct hvc_struct *h
 
 	/* Read data if any */
 	for (;;) {
-		count = tty_buffer_request_room(tty, N_INBUF);
+		int count = tty_buffer_request_room(tty, N_INBUF);
 
 		/* If flip is full, just reschedule a later read */
 		if (count == 0) {
@@ -633,7 +633,7 @@ static int hvc_poll(struct hvc_struct *h
 			tty_insert_flip_char(tty, buf[i], 0);
 		}
 
-		if (tty->flip.count)
+		if (count)
 			tty_schedule_flip(tty);
 
 		/*
diff -puN drivers/char/hvcs.c~tty-layer-buffering-revamp-further-tty-bits drivers/char/hvcs.c
--- devel/drivers/char/hvcs.c~tty-layer-buffering-revamp-further-tty-bits	2005-09-13 18:24:45.000000000 -0700
+++ devel-akpm/drivers/char/hvcs.c	2005-09-13 18:24:45.000000000 -0700
@@ -456,12 +456,11 @@ static int hvcs_io(struct hvcs_struct *h
 	/* remove the read masks */
 	hvcsd->todo_mask &= ~(HVCS_READ_MASK);
 
-	if ((tty->flip.count + HVCS_BUFF_LEN) < TTY_FLIPBUF_SIZE) {
+	if (tty_buffer_request_room(tty, HVCS_BUFF_LEN) >= HVCS_BUFF_LEN) {
 		got = hvc_get_chars(unit_address,
 				&buf[0],
 				HVCS_BUFF_LEN);
-		for (i=0;got && i<got;i++)
-			tty_insert_flip_char(tty, buf[i], TTY_NORMAL);
+		tty_insert_flip_string(tty, buf, got);
 	}
 
 	/* Give the TTY time to process the data we just sent. */
@@ -469,10 +468,9 @@ static int hvcs_io(struct hvcs_struct *h
 		hvcsd->todo_mask |= HVCS_QUICK_READ;
 
 	spin_unlock_irqrestore(&hvcsd->lock, flags);
-	if (tty->flip.count) {
-		/* This is synch because tty->low_latency == 1 */
+	/* This is synch because tty->low_latency == 1 */
+	if(got)
 		tty_flip_buffer_push(tty);
-	}
 
 	if (!got) {
 		/* Do this _after_ the flip_buffer_push */
diff -puN drivers/char/Kconfig~tty-layer-buffering-revamp-further-tty-bits drivers/char/Kconfig
--- devel/drivers/char/Kconfig~tty-layer-buffering-revamp-further-tty-bits	2005-09-13 18:24:45.000000000 -0700
+++ devel-akpm/drivers/char/Kconfig	2005-09-13 18:24:45.000000000 -0700
@@ -80,7 +80,7 @@ config SERIAL_NONSTANDARD
 
 config COMPUTONE
 	tristate "Computone IntelliPort Plus serial support"
-	depends on SERIAL_NONSTANDARD && BROKEN_ON_SMP
+	depends on SERIAL_NONSTANDARD
 	---help---
 	  This driver supports the entire family of Intelliport II/Plus
 	  controllers with the exception of the MicroChannel controllers and
@@ -153,7 +153,7 @@ config DIGIEPCA
 
 config ESPSERIAL
 	tristate "Hayes ESP serial port support"
-	depends on SERIAL_NONSTANDARD && ISA && BROKEN_ON_SMP && ISA_DMA_API
+	depends on SERIAL_NONSTANDARD && ISA && ISA_DMA_API
 	help
 	  This is a driver which supports Hayes ESP serial ports.  Both single
 	  port cards and multiport cards are supported.  Make sure to read
diff -puN drivers/usb/class/bluetty.c~tty-layer-buffering-revamp-further-tty-bits drivers/usb/class/bluetty.c
--- devel/drivers/usb/class/bluetty.c~tty-layer-buffering-revamp-further-tty-bits	2005-09-13 18:24:45.000000000 -0700
+++ devel-akpm/drivers/usb/class/bluetty.c	2005-09-13 18:24:45.000000000 -0700
@@ -792,15 +792,8 @@ static void bluetooth_int_callback (stru
 	}
 
 	if (packet_size + EVENT_HDR_SIZE == bluetooth->int_packet_pos) {
-		for (i = 0; i < bluetooth->int_packet_pos; ++i) {
-			/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them */
-			if (bluetooth->tty->flip.count >= TTY_FLIPBUF_SIZE) {
-				tty_flip_buffer_push(bluetooth->tty);
-			}
-			tty_insert_flip_char(bluetooth->tty, bluetooth->int_buffer[i], 0);
-		}
+		tty_insert_flip_string(bluetooth->tty, bluetooth->int_buffer, bluetooth->int_packet_pos);
 		tty_flip_buffer_push(bluetooth->tty);
-
 		bluetooth->int_packet_pos = 0;
 	}
 
@@ -920,13 +913,7 @@ static void bluetooth_read_bulk_callback
 	}
 
 	if (packet_size + ACL_HDR_SIZE == bluetooth->bulk_packet_pos) {
-		for (i = 0; i < bluetooth->bulk_packet_pos; ++i) {
-			/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
-			if (bluetooth->tty->flip.count >= TTY_FLIPBUF_SIZE) {
-				tty_flip_buffer_push(bluetooth->tty);
-			}
-			tty_insert_flip_char(bluetooth->tty, bluetooth->bulk_buffer[i], 0);
-		}
+		tty_insert_flip_string(bluetooth->tty, bluetooth->bulk_buffer, bluetooth->bulk_packet_pos);
 		tty_flip_buffer_push(bluetooth->tty);
 		bluetooth->bulk_packet_pos = 0;
 	}	
diff -puN drivers/usb/serial/Kconfig~tty-layer-buffering-revamp-further-tty-bits drivers/usb/serial/Kconfig
--- devel/drivers/usb/serial/Kconfig~tty-layer-buffering-revamp-further-tty-bits	2005-09-13 18:24:45.000000000 -0700
+++ devel-akpm/drivers/usb/serial/Kconfig	2005-09-13 18:24:45.000000000 -0700
@@ -75,7 +75,7 @@ config USB_SERIAL_BELKIN
 
 config USB_SERIAL_WHITEHEAT
 	tristate "USB ConnectTech WhiteHEAT Serial Driver"
-	depends on USB_SERIAL && BROKEN_ON_SMP
+	depends on USB_SERIAL
 	help
 	  Say Y here if you want to use a ConnectTech WhiteHEAT 4 port
 	  USB to serial converter device.
_