From patchwork Wed Feb 1 14:26:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 13124458 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 3C4D9C05027 for ; Wed, 1 Feb 2023 14:42:11 +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=MiMjwe/1o6hPWbgxeB4MTI2il/ib9qMjadgk2KIIBWI=; b=Ork6rLqy8aRtKH ZoCjo1qTG9M/q6Vsvgd3BQZxylHDWox/dd4CbDCI15u3SVmKp1rWDmgL2LsHj0jLVwmJyGcijCbgw vUuNQGZRwtMm+1cqPPWk5Rm9TcvIn+tg0GLJK9rYmXOVhr6ySK+FMjStZAmtSkOkjrm81nXSMsrqJ psfiBoxxFERHsSB+aPVnwwyeIq0vDcTyEpKFIpRU6sxEpv/svIh8GzQX0VLHwpC0lDxZ5HX6sXpVT 7Us6N6UU8N7rSffPQvOjJ6svy8fGX6kGtawIHtfPxqdS4HJA+ZGR+eWbEF29eXrirNTqv642nlZdY jQ/KWdJx9dl2kSr9uPcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNEI9-00CRRK-Lw; Wed, 01 Feb 2023 14:40:55 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNE5R-00CLo7-QK for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 14:27:47 +0000 Received: by mail-ed1-x52b.google.com with SMTP id n6so15221250edo.9 for ; Wed, 01 Feb 2023 06:27:45 -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=WEm5A99uTG2c238a+JDBkz/mOTpdwi/bBFV9FIiWCUw=; b=hqqEqTK0vARzjhmqa9hC6bsI/43ShQLK8//yNN4LKLiy2WkIGvyXDYZ2m8GwRYhND9 bDzPhj4P3JTMuOHV7ReCUIXnc+k2DCtkuR5WATi1e7simYqn/scDIwWxlbFDqU4KBPXa eZE33vSPuG4gKrpDbQf+ma7fIakaRy+/RXJ2rEjomknemkaxN2HKc5nAxtz5XIpuaRfe puxzpZUI8J04cDtaG4LZIeabkjgsApoH4KDJtMnW1DwWjeFb9Hm/LTHGGmNzxV//ZyrK HMNT3e/PUk/YtM9L+ZlZ5mRx45dDZ0cIiRwiQFQ6YUfQTutjE7IRwN5dxXFb9HS44Xh/ L0pA== 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=WEm5A99uTG2c238a+JDBkz/mOTpdwi/bBFV9FIiWCUw=; b=o0M4+5rlukPQx1B4M5VuVxzhT1UWTUcQPYdWS4dkEpuzvb2/5L9KlUCS6NlBWwozYU x0yYTgnJFcVhzmw26U1Li+tO5i0CdWBJzv1mhroUQojBj0+JOC5bbKvK/3HtmMpL9yi4 HaT2yzAFvvtYvCrKOIwNNO/I/7hoCdPD7Z8pnJ9KQoLz7KDpDZ3r4etnZ4PNQ49LIHhK 4EqOqHwqIZKrxWnTFrNy8NKOWRv9rfBDfJxYnzHR7tCPqAGT4RbXyS13+H6Qe+M0qA8d /6tUyiGQYeq0ftKZYivD4dtckoO3AZtLpGdHW9oolGqm8CV+hl8iCdJAMiZU+482Rxp0 Wrzw== X-Gm-Message-State: AO0yUKVJdjPuYy3EbHWsanYJf29AnW1myXAFALJqFCLxqe+X8V/QEgMU rf7Gj305xODkx9keaaQLCdc= X-Google-Smtp-Source: AK7set8ws7NdcXePeM55LM4BT1j7mYwM+w20CWy2QWuufVGR25bLp8ZxOOgYCX5HpeGK6TKSRutHlA== X-Received: by 2002:aa7:de13:0:b0:499:d0e3:7745 with SMTP id h19-20020aa7de13000000b00499d0e37745mr2245544edv.14.1675261664352; Wed, 01 Feb 2023 06:27:44 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id cf8-20020a0564020b8800b004a18f2ffb86sm8975564edb.79.2023.02.01.06.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 06:27:43 -0800 (PST) From: Sergey Organov To: Greg Kroah-Hartman Cc: linux-serial@vger.kernel.org, Fabio Estevam , Jiri Slaby , Richard Genoud , Sascha Hauer , Shawn Guo , Tim Harvey , =?utf-8?q?Tomasz_Mo=C5=84?= , =?utf-8?q?Uwe_Kle?= =?utf-8?q?ine-K=C3=B6nig?= , Johan Hovold , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sherry Sun , Stefan Wahren , linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Sergey Organov Subject: [PATCH v1 4/7] serial: imx: do not break from FIFO reading loop prematurely Date: Wed, 1 Feb 2023 17:26:57 +0300 Message-Id: <20230201142700.4346-5-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230201142700.4346-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230201142700.4346-1-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230201_062745_947772_ECE6D001 X-CRM114-Status: GOOD ( 14.06 ) 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 e709118fe85c..797c441088a9 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); @@ -944,13 +941,12 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) } 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;