From patchwork Thu Dec 21 23:18:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743311dyi; Thu, 21 Dec 2023 15:21:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjvtsYifD3lrg1UsyER3SEu56/l8eYJqFz8MzDa4HFOKf6P1Yv5AUYeR50uvLcoxAitVmV X-Received: by 2002:a05:6358:71cd:b0:173:50b:26de with SMTP id u13-20020a05635871cd00b00173050b26demr529363rwu.30.1703200898683; Thu, 21 Dec 2023 15:21:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200898; cv=none; d=google.com; s=arc-20160816; b=nqKogtTvf2Eb499a468GYNBiK3ZeAB0HDn+0kG3g1w6nan2Zoiyd8LakAWDUwUjqKm Z544Ky+AuddDo0RdVrePhwuDh+/F3mUUjkO2h3TPFX1xCBleW6u5fTWXzahR11yRJyKx 7HEfB25F1D+C2yxkF1sVU/+Dkq1z7mL65Dma4hT+VVQcRVU5Dr+pBrcGMoegt+mSWVDz 1d1UBozUeRMrQdPpWh+TYuUoigy9HG4hcvY80OsSv94ZAMiXLnm3Za8jvsqgB/ivRZen 227lEeaxfzYuCpykquJ8zpfoezsCKqzCDMfUlSEe1pnuOqxZLxPaRujEGrpWnFz97r8c R9uw== 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=HA7+L1TaISt3Svh27a9k0fge85v3P4K87hnDFOUnN00=; fh=xLWyschydcwW23fRlVvCnAn0jM2rGvhMoJ71MHWBla4=; b=I9flJ4N5MWMirWXiX5QpxW1IcSOlnD/v7vzDKu+VYjIZmv0cFQqBBpWVYqpN59xbqr iw2kI7YCmn9klclR42DilfZzzGw6tdQ3SUPtmZfr5qolyThSqAn0VIkyFMve4bkrEqQP pqhxz0JoFmwDDMiOyYGnvSh5Gsds9EKAEYSrWCN+/uJvAFSSAJ7VK+Fkv7NhddJqug7r Rjy7HqgfxMhM0OJVrj7E9ICyHnCKjClLc4/u71imamUzYVJmSf8laXdaMpTpiYFlGGd5 wK/Tmc6W7wGvNRwI1L/ysHfeu9zAab9Kz4DAlzQPQ+/HcQfFrSPjO3PDq9Zq8aGwFVwA KiXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=WxhDJyKs; spf=pass (google.com: domain of linux-kernel+bounces-9163-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9163-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 k82-20020a628455000000b006d97bdcd7cesi1168790pfd.22.2023.12.21.15.21.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:21:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9163-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=WxhDJyKs; spf=pass (google.com: domain of linux-kernel+bounces-9163-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9163-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 18834287EB1 for ; Thu, 21 Dec 2023 23:21:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 212947CCFC; 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="WxhDJyKs" 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 5437A79952; Thu, 21 Dec 2023 23:18:51 +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=HA7+L1TaISt3Svh27a9k0fge85v3P4K87hnDFOUnN00=; b=WxhDJyKs79ADXRdCCozlZ+Oghl RsWh0p/tFIL0ge+aBFqSrQGpWaLE4Uoxv2Pv7b3ajnwylfVPjSsWTJ9q5MXlhcTJKJW2LM303nev4 vKANFiPr4La4KHzK1W+lE6nbtqMyUrTHASiiMqKmfj5qDTds9/T7DUr0w3wkK20lMIw8=; 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 1rGSJS-00025W-Sg; Thu, 21 Dec 2023 18:18:47 -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 , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:19 -0500 Message-Id: <20231221231823.2327894-13-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 12/16] serial: sc16is7xx: replace hardcoded divisor value with BIT() macro 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: 1785935585808037517 X-GMAIL-MSGID: 1785935585808037517 From: Hugo Villeneuve To better show why the limit is what it is, since we have only 16 bits for the divisor. Reviewed-by: Andy Shevchenko Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index da862b8efcbe..3d963fe0e78a 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -486,7 +486,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud) u8 prescaler = 0; unsigned long clk = port->uartclk, div = clk / 16 / baud; - if (div > 0xffff) { + if (div >= BIT(16)) { prescaler = SC16IS7XX_MCR_CLKSEL_BIT; div /= 4; }