From patchwork Fri Jan 13 18:43:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 13101492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFD53C3DA78 for ; Fri, 13 Jan 2023 18:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2nAsQOlfStTZBJaCzgVepv9kz0cXrdImwhu0OpihQXk=; b=M/0yCFO3N3UAVg lCn4XKM3T/faazulpFJMcB+Fs3AG8/0J6XgNrfsegzWFXSqgosAPaj7aQU8G/YrZzL9rEmnhkRN6r h6VIocjJ59fCHerFCtBXZ5Q9SNo1w80lg43sUq6IeN3FHVTS/wncCNs05LdoI3ozLUJd7q0GYML0o 9koRYyAHuELR/cBBf80MhatfOgwl6v/bSlNLlJpAs0mUv8eEV/o6yEie/jrDi5roWmtVwIkkpoIk+ 7DoitiCZ9rU66hoKcoGtctXQE94Y4EeKX9u0e+MFWvGIHbbSAFHP+L6rAJlMdH9j9jCJm8hEjFOjz II8ugeHZ0g+PxpQJ1/aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGP2P-0045S6-Aq; Fri, 13 Jan 2023 18:44:25 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGP1o-0045I6-Pg for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2023 18:43:50 +0000 Received: by mail-lf1-x134.google.com with SMTP id bu8so34296605lfb.4 for ; Fri, 13 Jan 2023 10:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BEuxX1Ll6053jaM5wYHpbycjGtKOkT1kwUWem6LtYrM=; b=Qv3ZTHYSreLfmMGbsEJVQeKAj0Rsp2AJskikpPzMRGkYLhwu1mXNJoM40qhoqE2Q2N uvKLSM6tPyqNDvP4FVR3V6bs2ptSBvEAVoyXwumN6eTN6gmMZayssMjpShx1E4HGJTqa 842DzUOAgACQtCZe2pgOxXqw55+UfF5XeL9RPfyv798meJ2/U2jWSkOrSTnNXYu7r9cW Jc9TJUmBENDr2gbsacQroSK/NgVhIDxBwCDR/svbH7hn/C6RCxVAR6kETLPsU/aHg1DF Es4c2eRfGJrbmAUPRjeiqpkg3bDP304P1eL60EgJgkQjZTPku1KA2VIQF4nWu9aKlqwH GuXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BEuxX1Ll6053jaM5wYHpbycjGtKOkT1kwUWem6LtYrM=; b=AYD7jPCQhI8OZETg24JHDoiajBPdMputvZXPGHZmwOjqj04NOQax3Yt8DW3ISfYFbU AYIdVrvRpiNo6sLsX9EXjL8bFDTY31/OyUMGdIUoT99Y7GXcnpw6jGKCReJkS/TRqR/D RCSbuptYHG/e1jJFKUg8/4TT3s8GSK4rp1L44lx1gSwYv4iX4zmo6Uk1H9XnfwWHy0r8 doRXqsUJZpX3agH/JQlcuPGEBrXYeE2hSHp0onz4JgiKPbTJsNsH0F8vSKzJfzagE/yx gY9+0E3iuh+EgosVBcV9eT1pr4FJLzZCOuXaanbRSxl/PvPEZvf5Pmov8YjvqvodM2Ls H5lg== X-Gm-Message-State: AFqh2kqiK451rDHTGy4G9r/4GzXMeE32O97uBgu0DGrh6lyefuWJjuH0 KBzaL55bbBr4y2MSzLYHOHPSdysrTO8= X-Google-Smtp-Source: AMrXdXvFqBm0yaQK2e38U4fE47XqSrNqGwyGOCkcCBfg8zyQzVL6ozWAI3Dhet38lYjyS8B+I/lR5Q== X-Received: by 2002:a05:6512:10d0:b0:4cb:4374:cc78 with SMTP id k16-20020a05651210d000b004cb4374cc78mr16172770lfg.26.1673635426335; Fri, 13 Jan 2023 10:43:46 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id o11-20020ac2434b000000b004cc9ddce3adsm1261439lfl.82.2023.01.13.10.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 10:43:45 -0800 (PST) From: Sergey Organov To: linux-serial@vger.kernel.org Cc: Fabio Estevam , Greg Kroah-Hartman , Jiri Slaby , Richard Genoud , Sascha Hauer , Shawn Guo , Tim Harvey , =?utf-8?q?Tomasz_Mo=C5=84?= , linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Sergey Organov Subject: [PATCH 4/8] serial: imx: do not break from FIFO reading loop prematurely Date: Fri, 13 Jan 2023 21:43:30 +0300 Message-Id: <20230113184334.287130-5-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230113184334.287130-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230113184334.287130-1-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230113_104348_875389_FE132576 X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is no reason to prematurely break out of FIFO reading loop, and it might cause needless reenters into ISR, so keep reading until FIFO is empty. Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 1c950112a598..b96b0edc7854 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -888,7 +888,7 @@ static void imx_uart_check_flood(struct imx_port *sport, u32 usr2) static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) { struct imx_port *sport = dev_id; - unsigned int rx, flg, ignored = 0; + unsigned int rx, flg; struct tty_port *port = &sport->port.state->port; u32 usr2; @@ -921,11 +921,8 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) if (rx & URXD_OVRRUN) sport->port.icount.overrun++; - if (rx & sport->port.ignore_status_mask) { - if (++ignored > 100) - goto out; + if (rx & sport->port.ignore_status_mask) continue; - } rx &= (sport->port.read_status_mask | 0xFF); @@ -943,13 +940,12 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) continue; if (sport->port.ignore_status_mask & URXD_DUMMY_READ) - goto out; + continue; if (tty_insert_flip_char(port, rx, flg) == 0) sport->port.icount.buf_overrun++; } -out: tty_flip_buffer_push(port); return IRQ_HANDLED;