]> git.karo-electronics.de Git - linux-beck.git/commitdiff
n_tty: Reduce branching in canon_copy_from_read_buf()
authorPeter Hurley <peter@hurleysoftware.com>
Fri, 27 Nov 2015 19:11:04 +0000 (14:11 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Dec 2015 03:59:48 +0000 (19:59 -0800)
Instead of compare-and-set, just compute 'found'.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c

index bc613b868e711c5fadbd5f6d4ad9585d1981b297..f2f64252814f9bfb07ced7f090e6301fde2f831d 100644 (file)
@@ -2080,10 +2080,9 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
        if (eol == N_TTY_BUF_SIZE && more) {
                /* scan wrapped without finding set bit */
                eol = find_next_bit(ldata->read_flags, more, 0);
-               if (eol != more)
-                       found = 1;
-       } else if (eol != size)
-               found = 1;
+               found = eol != more;
+       } else
+               found = eol != size;
 
        n = eol - tail;
        if (n > N_TTY_BUF_SIZE)