From patchwork Tue Dec 19 17:18:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095053dyi; Tue, 19 Dec 2023 09:23:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0Ltl4mSR2sNlXIsqY9jCJ2lEei0XZyDGQr4bT4z+wbVs8cr+dgRny/4IG+A90hmQLx3zT X-Received: by 2002:a17:906:3606:b0:a23:4da5:d610 with SMTP id q6-20020a170906360600b00a234da5d610mr2188945ejb.100.1703006618477; Tue, 19 Dec 2023 09:23:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006618; cv=none; d=google.com; s=arc-20160816; b=jv7Bq7dACA/1Lc2Huf5Ah+7jecN4vIh5OtSxrhPXA3eTiv/Yk9GwiX5Ep7SpxGsdWz tPRpD8I3HAz0WMnJMWyLJesO6wDPHHE3Lhlo3J9Y8r96aJipm7t+wyIDf+T6WQuL9L67 /QJUFhryYmx9iy2PGM1KGio/gNKMAEsWZOvmvHX0g0HE9/LAi6YdwxQk+cLuvizA3laq zBj6obV+wX0c/LPZCeZ6Q0oDS27fRhAXkLCpmjX9nnNQgo6ZSpnBo2QxyXq8NljoMNl5 BzcCgFhFfXkAT5gdTVTvgXao1dcf8wA+iB4m/ai4YUJr5zS8mee1U2OdBRh2IC5aGKVz 2jYg== 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=wIhfJw84538n4x2qE0zhacVXgJE56py7Ypbq2I5JZ+8=; fh=a4WmmkWtrWkl6GT2O1otVp3028EnXdnaDQnaGXCvODo=; b=pwYdKZDnCG1YZxlPJWGZm22k6vGYHq+zsRY1CW0NqAvK9GR8jzOpP9GSdlEdWXF2NH lBYbPO/8SPPZhKuE3FRvhn/ETR5L5auUSs1m+XEhElTBx3Pq6Qsm6n7oH4AxsX542Rwn ceQvK4AoCckW2MqA9UPKG6LSJoNgrcWrFsTZ/nWNMohA96mrgwkjPHcrllw3gJu/4Pj5 5jeqG1exnaEA1ZvcDG1SQCZY3cmbqEgKTNUB1TPOBYIDyo/JJ4qJoFPM28ZEPGpN9F3n Tw9kOy9osKYRm3qGpgubO2NQp8ExW3ud03l+LfQxsuohVnO7J4wXlIGK8FxSPC+wX2wr RrSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=KVIIQGPA; spf=pass (google.com: domain of linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z9-20020a170906714900b00a235dfc2621si1630208ejj.258.2023.12.19.09.23.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=KVIIQGPA; spf=pass (google.com: domain of linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5674-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 am.mirrors.kernel.org (Postfix) with ESMTPS id C447C1F213E9 for ; Tue, 19 Dec 2023 17:23:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88AB93D0CB; Tue, 19 Dec 2023 17:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="KVIIQGPA" 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 1D94237146; 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=wIhfJw84538n4x2qE0zhacVXgJE56py7Ypbq2I5JZ+8=; b=KVIIQGPATtH3Pn7WYoG+KvGah1 r/Y7s9pDUYBP5gslMkJ4ByM1gjt4VOusKN7uVyelPl4vn7fZOCX42OUqa38RwQsxwEZReKq7fYICS aTX7k2GsdZSsOoYQWAX6xVQ3oBLRu/IjvB0O8aSemohXPODPOzb6r/4fkBuBR33KGF/M=; 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 1rFdkM-0007Ao-OM; Tue, 19 Dec 2023 12:19:11 -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:48 -0500 Message-Id: <20231219171903.3530985-5-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 04/18] 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: 1785731867968739013 X-GMAIL-MSGID: 1785731867968739013 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index b2d0f6d307bd..8a038a9be09e 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -782,17 +782,17 @@ 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 { + keep_polling = false; int i; 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; }