aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-22 06:13:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 16:03:24 -0400
commitf035a8ad158f0bdc94125004488b0ea8438edaa9 (patch)
tree98c753c33ce5bd91b9cc2cc567dc44159791432c /drivers/usb/serial
parentdeb91685784fc0bc845c582f8b2bc229cb7bc9da (diff)
keyspan: Use string flip functions when possible
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/keyspan.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 2b1cfcbf8f9b..704716f6f6d3 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -577,7 +577,7 @@ static void usa26_glocont_callback(struct urb *urb)
577 577
578static void usa28_indat_callback(struct urb *urb) 578static void usa28_indat_callback(struct urb *urb)
579{ 579{
580 int i, err; 580 int err;
581 struct usb_serial_port *port; 581 struct usb_serial_port *port;
582 struct tty_struct *tty; 582 struct tty_struct *tty;
583 unsigned char *data; 583 unsigned char *data;
@@ -606,8 +606,7 @@ static void usa28_indat_callback(struct urb *urb)
606 606
607 tty = port->port.tty; 607 tty = port->port.tty;
608 if (urb->actual_length) { 608 if (urb->actual_length) {
609 for (i = 0; i < urb->actual_length ; ++i) 609 tty_insert_flip_string(tty, data, urb->actual_length);
610 tty_insert_flip_char(tty, data[i], 0);
611 tty_flip_buffer_push(tty); 610 tty_flip_buffer_push(tty);
612 } 611 }
613 612
@@ -833,8 +832,8 @@ static void usa49_indat_callback(struct urb *urb)
833 /* 0x80 bit is error flag */ 832 /* 0x80 bit is error flag */
834 if ((data[0] & 0x80) == 0) { 833 if ((data[0] & 0x80) == 0) {
835 /* no error on any byte */ 834 /* no error on any byte */
836 for (i = 1; i < urb->actual_length ; ++i) 835 tty_insert_flip_string(tty, data + 1,
837 tty_insert_flip_char(tty, data[i], 0); 836 urb->actual_length - 1);
838 } else { 837 } else {
839 /* some bytes had errors, every byte has status */ 838 /* some bytes had errors, every byte has status */
840 for (i = 0; i + 1 < urb->actual_length; i += 2) { 839 for (i = 0; i + 1 < urb->actual_length; i += 2) {
@@ -973,10 +972,9 @@ static void usa90_indat_callback(struct urb *urb)
973 /* if current mode is DMA, looks like usa28 format 972 /* if current mode is DMA, looks like usa28 format
974 otherwise looks like usa26 data format */ 973 otherwise looks like usa26 data format */
975 974
976 if (p_priv->baud > 57600) { 975 if (p_priv->baud > 57600)
977 for (i = 0; i < urb->actual_length ; ++i) 976 tty_insert_flip_string(tty, data, urb->actual_length);
978 tty_insert_flip_char(tty, data[i], 0); 977 else {
979 } else {
980 /* 0x80 bit is error flag */ 978 /* 0x80 bit is error flag */
981 if ((data[0] & 0x80) == 0) { 979 if ((data[0] & 0x80) == 0) {
982 /* no errors on individual bytes, only 980 /* no errors on individual bytes, only