Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp271162rdb; Thu, 21 Dec 2023 08:41:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/01YCtBK6tK/gUQWCJRXZnZ8Zj5XxB348ZsfDdQi8U/vtVK+vTKCXPZqZHjVRdCGMgzUM X-Received: by 2002:a05:6a00:2188:b0:6d0:d819:dbb5 with SMTP id h8-20020a056a00218800b006d0d819dbb5mr14661802pfi.21.1703176915813; Thu, 21 Dec 2023 08:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703176915; cv=none; d=google.com; s=arc-20160816; b=WeXV4mF+hDG7CM9Rpa4t+WMBA0CivG/OQbJg34YtQbJW+unpli7lRxYFI8pgX1dutf ZmxZabTwThbfnF8ycxg2qiWpos7sprUtGt3Mccb8f83l2HuxSW15ViRC2Wpxxx6SOz4K iXV8d05kVtskk+bNtPCxajdLj6WdTXTsqWm7ScL8QokiEe/PqGY3qODESlpnzd0RR2Uk zigBmjW4zt4AezJLuWMPtW/qXiMmmzWgukT3zVRMoBSCnAv2Uxsievcmm/K63Rcw7J44 JeJvaMFBU8vQZ5PCyW4e5dHK0xhADoQFEa6LcMe3yUaD6Qq8wXd7U/IK7VUUxMwC9URV Ep5A== 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 :cc:to:from:date:dkim-signature; bh=2Q9t7C2SbakvEAyAANdhIwq7Q4HehUia7VOTnZPPwiY=; fh=14hSPZ65oo+tnnL74V623J+PyENmptCqr2QpE7PuBVY=; b=W9m8vLNiqxcEzWrQp9rHech6oFPM2Y55VP8XAuwPfrVLBh8EUqDPuz8jFbounJlbu8 tnQU08V6EzdvzWJupWfUS2HPU17RbMYq9QFzmoXAOYmlTbtLpWLRjINSOVOJ/wd3MUne be8vL9AaE3OUMP/gtEY4PPveSysLq1qREuYH+P6uRrPryQIgpGrGcNfep0vfd9NfnJ8i fudrZg6cE/y9rLdsJk/jHdaSQGdUh+7qy4hjqgNJ5bon++mtuaYx1pZMfRwtN0oOLjvz S8y9uTn1ULfg27+AO/7ld2uCqq9vTPfpWvV41cIxCGvvvvA2hXtDMcry33wsamboZkXT zgCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=pgifOCnJ; spf=pass (google.com: domain of linux-kernel+bounces-8786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8786-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w8-20020a63f508000000b005c668a5a90esi1815795pgh.596.2023.12.21.08.41.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:41:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8786-linux.lists.archive=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=pgifOCnJ; spf=pass (google.com: domain of linux-kernel+bounces-8786-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8786-linux.lists.archive=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 76782285965 for ; Thu, 21 Dec 2023 16:41:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D2625993E; Thu, 21 Dec 2023 16:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="pgifOCnJ" 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 D938F5990C; Thu, 21 Dec 2023 16:41:13 +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:Cc:To:From :Date:subject:date:message-id:reply-to; bh=2Q9t7C2SbakvEAyAANdhIwq7Q4HehUia7VOTnZPPwiY=; b=pgifOCnJRKp+1KXkCqOoMeIv9u LcIdf+l31BfdI0vRUkZhsKr7bqtZC3rps8Dx6aYNRki/LvfO6Tp/na2xkN7OfvciIYIISVkruYaOq lOmTU93KEZhVF1BxZs69F79xYWoDyggojQFSOr8T7Lj4rXmj0Gk6RnnGmhx+9LdRsLwc=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:53502 helo=pettiford) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGM6a-0006rz-0Y; Thu, 21 Dec 2023 11:41:05 -0500 Date: Thu, 21 Dec 2023 11:41:03 -0500 From: Hugo Villeneuve To: Andy Shevchenko Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve Message-Id: <20231221114103.557409e9875a0f2f95eacfb6@hugovil.com> In-Reply-To: References: <20231219171903.3530985-1-hugo@hugovil.com> <20231219171903.3530985-10-hugo@hugovil.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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. * -3.8 NICE_REPLY_A Looks like a legit reply (A) Subject: Re: [PATCH 09/18] serial: sc16is7xx: add macro for max number of UART ports 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) On Wed, 20 Dec 2023 17:50:34 +0200 Andy Shevchenko wrote: > On Tue, Dec 19, 2023 at 12:18:53PM -0500, Hugo Villeneuve wrote: > > From: Hugo Villeneuve > > > > Add macro to hold the maximum number of UART ports per IC/device. > > ... > > > - if (count < 0 || count > ARRAY_SIZE(irda_port)) > > + if (count < 0 || count > SC16IS7XX_MAX_PORTS) > > ARRAY_SIZE() is more robust than this. What if you change to support different > devices where this won't be as defined? Hi, not sure that I understand your point, because SC16IS7XX_MAX_PORTS is the maximum for all devices supported by this driver. The irda_port array always has a fixed number of elements set to SC16IS7XX_MAX_PORTS, even if the device that we are probing has only one port for example. But I can change it back to ARRAY_SIZE(irda_port) if you want. > > > return; > > ... > > > - if (count < 0 || count > ARRAY_SIZE(mctrl_port)) > > + if (count < 0 || count > SC16IS7XX_MAX_PORTS) > > return 0; > > Ditto. > > ... > > > + WARN_ON(devtype->nr_uart > SC16IS7XX_MAX_PORTS); > > Not sure about this, perhaps it's fine. This check is only there if we add support for a new device and we incorrectly set nr_uart to an incorrect value, which will cause other problems anyway, of course :) This could be removed. Hugo Villeneuve