Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755219AbbK0TLz (ORCPT ); Fri, 27 Nov 2015 14:11:55 -0500 Received: from mail-ig0-f174.google.com ([209.85.213.174]:34134 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755037AbbK0TLM (ORCPT ); Fri, 27 Nov 2015 14:11:12 -0500 From: Peter Hurley To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-kernel@vger.kernel.org, Peter Hurley Subject: [PATCH v2 3/3] n_tty: Reduce branching in canon_copy_from_read_buf() Date: Fri, 27 Nov 2015 14:11:04 -0500 Message-Id: <1448651464-4103-4-git-send-email-peter@hurleysoftware.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448651464-4103-1-git-send-email-peter@hurleysoftware.com> References: <1446993310-7681-1-git-send-email-peter@hurleysoftware.com> <1448651464-4103-1-git-send-email-peter@hurleysoftware.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 984 Lines: 33 Instead of compare-and-set, just compute 'found'. Signed-off-by: Peter Hurley --- drivers/tty/n_tty.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index eab606a..9b0b610 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -2079,10 +2079,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) -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/