]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
keyspan: Use string flip functions when possible
authorAlan Cox <alan@redhat.com>
Tue, 22 Jul 2008 10:13:32 +0000 (11:13 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Jul 2008 20:03:24 +0000 (13:03 -0700)
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>
drivers/usb/serial/keyspan.c

index 2b1cfcbf8f9bcd2e8780a5c7390586ea174c604a..704716f6f6d378c825920c213f3cedd7585b0ab5 100644 (file)
@@ -577,7 +577,7 @@ static void usa26_glocont_callback(struct urb *urb)
 
 static void usa28_indat_callback(struct urb *urb)
 {
-       int                     i, err;
+       int                     err;
        struct usb_serial_port  *port;
        struct tty_struct       *tty;
        unsigned char           *data;
@@ -606,8 +606,7 @@ static void usa28_indat_callback(struct urb *urb)
 
                tty = port->port.tty;
                if (urb->actual_length) {
-                       for (i = 0; i < urb->actual_length ; ++i)
-                               tty_insert_flip_char(tty, data[i], 0);
+                       tty_insert_flip_string(tty, data, urb->actual_length);
                        tty_flip_buffer_push(tty);
                }
 
@@ -833,8 +832,8 @@ static void usa49_indat_callback(struct urb *urb)
                /* 0x80 bit is error flag */
                if ((data[0] & 0x80) == 0) {
                        /* no error on any byte */
-                       for (i = 1; i < urb->actual_length ; ++i)
-                               tty_insert_flip_char(tty, data[i], 0);
+                       tty_insert_flip_string(tty, data + 1,
+                                               urb->actual_length - 1);
                } else {
                        /* some bytes had errors, every byte has status */
                        for (i = 0; i + 1 < urb->actual_length; i += 2) {
@@ -973,10 +972,9 @@ static void usa90_indat_callback(struct urb *urb)
                /* if current mode is DMA, looks like usa28 format
                   otherwise looks like usa26 data format */
 
-               if (p_priv->baud > 57600) {
-                       for (i = 0; i < urb->actual_length ; ++i)
-                               tty_insert_flip_char(tty, data[i], 0);
-               } else {
+               if (p_priv->baud > 57600)
+                       tty_insert_flip_string(tty, data, urb->actual_length);
+               else {
                        /* 0x80 bit is error flag */
                        if ((data[0] & 0x80) == 0) {
                                /* no errors on individual bytes, only