From patchwork Thu Dec 21 23:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743435dyi; Thu, 21 Dec 2023 15:21:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuqhF3Hq8g2lHGNYsX4xTEZlACYj7mzbfTDyHYKIPN497H1Wy4PFTRH1kCzTvJCRiEUxdz X-Received: by 2002:a05:6870:8a27:b0:203:ea4e:38a7 with SMTP id p39-20020a0568708a2700b00203ea4e38a7mr723375oaq.31.1703200918934; Thu, 21 Dec 2023 15:21:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200918; cv=none; d=google.com; s=arc-20160816; b=W9yOb/EzTjiYSywRzMiGl/gTlftj3EGRHOlwmnuJOPAivD5oYWEZxbWBItBbR0pwVi wJVWQGI8n+sIPZS3GRVF2BM2F5uhZ91fhGABab0Pyro+oq3GbOzcThIcaN5RDzkMhYLY xs8J0BdxW/ox3Aq8t6g36f6jdPsrd6TretUAbq/O9Ie2EIdl/+4b76UkSYSUkzWn7rbE hkqxGqABZDNg3u/59ul8EFuLgXfuaXDda6FvRFb5KOjHebNj5DWu7DZXkCTu55eMCU3c LyfjL4h4rkJbyx+0ZQC2V5hbpJGM2lJkxBmvlvGDb8CgsgAugPIlCWGinPBJqLh6k+Ih 6law== 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=5Gtw+pSsdTFBBEqkupr/ySyhkeLR1vqxZ7FoqKXHAhE=; fh=VrdPxeUvMlYH3nPywpJvuymi4CMWfCOu5aFHWZiYuXs=; b=DLl2njCnAiV3huzJlfql+kSOHQI3PxaTB/zm861ejPNGAm03HUWQ1EO6WhsUojg+49 ieSGkB437OC6AGXrkEeTrIqggN1qeGlrwOHy2HfSCZYBCfaCvgc+UMJQpqp7bbNoiVLf wNTMNAX6GrdFu9fpP8q1tFbnd4gNtMl0dv97rdDFW+WXnl9HY5vGMQHZiK1ab1m9aEeI Xzt4kMMphTHvzcN9vvgteDj2jmJMvBNk8yMDLmb8iEpOjn+0b9ACz1ohWykiZh7mNE12 dBWzPvvAu9iVclmg0H4amsaL4pE1v2aElp79quk2Urw/Uwca4p26Fe3ldnEWK83Tsh3K y3rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=sPTaPtqJ; spf=pass (google.com: domain of linux-kernel+bounces-9166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9166-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y193-20020a638aca000000b005bd66bfc253si2318867pgd.148.2023.12.21.15.21.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:21:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=sPTaPtqJ; spf=pass (google.com: domain of linux-kernel+bounces-9166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9166-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A112C282F37 for ; Thu, 21 Dec 2023 23:21:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C82AE7D606; Thu, 21 Dec 2023 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="sPTaPtqJ" 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 CABE179463; Thu, 21 Dec 2023 23:18:50 +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=5Gtw+pSsdTFBBEqkupr/ySyhkeLR1vqxZ7FoqKXHAhE=; b=sPTaPtqJ0JI+NyxFj1ERZNv0zR VtAPq/GUzUMACkE7kRBQhBHT5HdUSa/U9j5e2wYa5qBaKdKmeAWUXG24n5rPogH+ibh2vYI/+gpEh 50SbHLlRNKe4pjaqOgXW1UQvkVyFmRafWXtvNAtGs3I5dyDg+Pf//Pis0A+w2UXs8uJc=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJK-00025W-3w; Thu, 21 Dec 2023 18:18:38 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:12 -0500 Message-Id: <20231221231823.2327894-6-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 05/16] serial: sc16is7xx: improve do/while loop in sc16is7xx_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: 1785935606758882212 X-GMAIL-MSGID: 1785935606758882212 From: Hugo Villeneuve Simplify and improve readability by replacing while(1) loop with do {} while, and by using the keep_polling variable as the exit condition, making it more explicit. 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 44a11c89c949..8d257208cbf3 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -783,17 +783,18 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) { + bool keep_polling; + struct sc16is7xx_port *s = (struct sc16is7xx_port *)dev_id; - while (1) { - bool keep_polling = false; + do { int i; + keep_polling = false; + for (i = 0; i < s->devtype->nr_uart; ++i) keep_polling |= sc16is7xx_port_irq(s, i); - if (!keep_polling) - break; - } + } while (keep_polling); return IRQ_HANDLED; }