From patchwork Tue Dec 19 17:18:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095748dyi; Tue, 19 Dec 2023 09:24:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFopSQPXBYDEHsFiekvmj5lEKpLwMnAXt0jWgKx0i6DsWuXZhrNXkEjgN8s89i2X0Sa8eiX X-Received: by 2002:a17:902:780e:b0:1d0:5ed4:4bf with SMTP id p14-20020a170902780e00b001d05ed404bfmr18495204pll.54.1703006690778; Tue, 19 Dec 2023 09:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006690; cv=none; d=google.com; s=arc-20160816; b=nrqeapVih8JFe7IkTLZdmVCznF1Ii0PegYFK/l7mjF7pPkn0EfGvdooVNryfLPHBOh nskBfhd9A+3iM8+sNMMPTCAjbpnVtkTe5HKkhSZfTA5mBYPFXrQgAkLZuA1Z6IBnpHEl uO9e2CrpnSZUzPWtiuK16ZddZ6vbPRw5cWFb86j56PYqyUCCPh/PbKYvE6OAPBzeiAph qSfrOlkjXAHMkv9RhJeZsqoKE658dic3v52bzrwNx5YV5qB4d3BIkWLiisBi6Ndn1o/Z /q7pBgwutlTsYvntqdfH0xSxvyiO7pCGQbEnLsO9Rm+aMXAqLJFjpru3Crtloj75EC4+ RpeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=CVt1Ut4/5of52yoyDCsnAtN3bYTRSEdMAPxWPWpZRoY=; fh=a4WmmkWtrWkl6GT2O1otVp3028EnXdnaDQnaGXCvODo=; b=vpaSdI0XlfxSi1v6KhfUrW38sW/Fr15axt2+xSICMyVqmkyQuuB/DUIt6VzKK9opT4 7f96xZo7WTuoTKfj7WOXrXp0nc/Ywlh9t5wMi8/IRkhhtA2VxL+L9BDjV1qfgC+wK+k2 M7N345T3pvLZmuAtpYWeNWdTdlU+iUQTVwDQVRDu/u2nrMaV9uHMdeoUHxjVsOK+4rfv 9AT2k8eakA8ByAAOjuytiHTRZx3uWYQlDf7kMHjJoT+JJ1R+XszN74Iz6X4VgDmmx9ZI 9Vzhuzz+c9HntcO1J9FezatH2I9YB7+lFd1yTYOiy4vFXDKsHbEOL29FEqXK5gjJnlnT abNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=H5FEowUH; spf=pass (google.com: domain of linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x24-20020a170902821800b001d34d365654si11439791pln.464.2023.12.19.09.24.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:24:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=H5FEowUH; spf=pass (google.com: domain of linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B529CB211D5 for ; Tue, 19 Dec 2023 17:24:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F061740BEE; Tue, 19 Dec 2023 17:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="H5FEowUH" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38C103714D; Tue, 19 Dec 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=CVt1Ut4/5of52yoyDCsnAtN3bYTRSEdMAPxWPWpZRoY=; b=H5FEowUHBNadact6idiPj8pFZH 4O8pOwFwj0Y4XYHrk2I+zqgrFv4FwyLBj3I2bh/WRRP9CDjHI2EfDFiXu3yxTq+eRTXnH4PbqznhT R0CkUbHI4t0VfutRTdldTl7EchSjLzUhr/JXS9S4PbaHoSxYL9LTAML+Qnmxq4QKeokE=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkL-0007Ao-IY; Tue, 19 Dec 2023 12:19:10 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:47 -0500 Message-Id: <20231219171903.3530985-4-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 03/18] serial: sc16is7xx: remove obsolete loop in sc16is7xx_port_irq() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731943807081667 X-GMAIL-MSGID: 1785731943807081667 From: Hugo Villeneuve Commit 834449872105 ("sc16is7xx: Fix for multi-channel stall") changed sc16is7xx_port_irq() from looping multiple times when there was still interrupts to serve. It simply changed the do {} while(1) loop to a do {} while(0) loop, which makes the loop itself now obsolete. Clean the code by removing this obsolete do {} while(0) loop. Fixes: 834449872105 ("sc16is7xx: Fix for multi-channel stall") Cc: stable@vger.kernel.org Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 85 ++++++++++++++++------------------ 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index b92fd01cfeec..b2d0f6d307bd 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -724,58 +724,55 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_one *one) static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) { bool rc = true; + unsigned int iir, rxlen; struct uart_port *port = &s->p[portno].port; struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); mutex_lock(&one->efr_lock); - do { - unsigned int iir, rxlen; + iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); + if (iir & SC16IS7XX_IIR_NO_INT_BIT) { + rc = false; + goto out_port_irq; + } - iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); - if (iir & SC16IS7XX_IIR_NO_INT_BIT) { - rc = false; - goto out_port_irq; - } + iir &= SC16IS7XX_IIR_ID_MASK; - iir &= SC16IS7XX_IIR_ID_MASK; - - switch (iir) { - case SC16IS7XX_IIR_RDI_SRC: - case SC16IS7XX_IIR_RLSE_SRC: - case SC16IS7XX_IIR_RTOI_SRC: - case SC16IS7XX_IIR_XOFFI_SRC: - rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG); - - /* - * There is a silicon bug that makes the chip report a - * time-out interrupt but no data in the FIFO. This is - * described in errata section 18.1.4. - * - * When this happens, read one byte from the FIFO to - * clear the interrupt. - */ - if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen) - rxlen = 1; - - if (rxlen) - sc16is7xx_handle_rx(port, rxlen, iir); - break; + switch (iir) { + case SC16IS7XX_IIR_RDI_SRC: + case SC16IS7XX_IIR_RLSE_SRC: + case SC16IS7XX_IIR_RTOI_SRC: + case SC16IS7XX_IIR_XOFFI_SRC: + rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG); + + /* + * There is a silicon bug that makes the chip report a + * time-out interrupt but no data in the FIFO. This is + * described in errata section 18.1.4. + * + * When this happens, read one byte from the FIFO to + * clear the interrupt. + */ + if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen) + rxlen = 1; + + if (rxlen) + sc16is7xx_handle_rx(port, rxlen, iir); + break; /* CTSRTS interrupt comes only when CTS goes inactive */ - case SC16IS7XX_IIR_CTSRTS_SRC: - case SC16IS7XX_IIR_MSI_SRC: - sc16is7xx_update_mlines(one); - break; - case SC16IS7XX_IIR_THRI_SRC: - sc16is7xx_handle_tx(port); - break; - default: - dev_err_ratelimited(port->dev, - "ttySC%i: Unexpected interrupt: %x", - port->line, iir); - break; - } - } while (0); + case SC16IS7XX_IIR_CTSRTS_SRC: + case SC16IS7XX_IIR_MSI_SRC: + sc16is7xx_update_mlines(one); + break; + case SC16IS7XX_IIR_THRI_SRC: + sc16is7xx_handle_tx(port); + break; + default: + dev_err_ratelimited(port->dev, + "ttySC%i: Unexpected interrupt: %x", + port->line, iir); + break; + } out_port_irq: mutex_unlock(&one->efr_lock);