Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp282315rdb; Thu, 21 Dec 2023 09:01:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMONXoYRq7pTi8LFIFimzRLA8vXcG1qujQun/c3yU57WAz63+05uqk6T3Zg6Ui3180TOCL X-Received: by 2002:a17:906:2318:b0:a1f:8a1e:952d with SMTP id l24-20020a170906231800b00a1f8a1e952dmr1008411eja.7.1703178078895; Thu, 21 Dec 2023 09:01:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703178078; cv=none; d=google.com; s=arc-20160816; b=UNg36hUjI2pRmXy+QxPh9GSm8UeKK9+4eSuEo1nSkpEZJrRaFJqdt/ZEZvfQOc8Dyp v8WYUoMVZACWyXc3AfrCLadTKiT0LxmnpXigdrVOU7Uy/w+oLqwpdx72Q8wqU9ukZdiw CNd0uKusPiXZGqVDUM7G64AR+vIELdHaW1X9a5pMLgmb4+j5zAmVpVhEqd7mp1JxQMcM dtG5+dCNu8VDbuPnNuvxnkc9Eq7KFvL3a/KncaCglg0bUppWwj0rNLLG5+wBXoLLiPKW D778k8tGUQxXVolCvuoOwmB66KXk5+M3dP7iIAbzxw1Pfp3RP3kfDKOcCydaVlEEvXQW xxgA== 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=B4CQ1XhxEhN3/jq/xBpStBFHE0rLx7trdKlpNSEDOVc=; fh=14hSPZ65oo+tnnL74V623J+PyENmptCqr2QpE7PuBVY=; b=t6C13ChvpvqNhNT9ClJ96RAMNBE5AL/qvrkhti2lT8e2M8Z/9v9gJ6ve4FDvSxM3RJ F/eTGG9FqB3cUgrDSs1+9gMYKm3/1/QDIwvH8BrOKaZv5ydCc/a3vjjVv9SyRma8ChgL NNgv4pJRyHNACGDNTVrcA0Jd2/OoiZB/Cu73a9zxU1bjhOkLJHgkXy3hqi+99uzU+dJW kRDLHzFNT9LxxopMs0jItd70LVz40nL91bu06/ujapWpBxX+lRiBZWgnuUnwM2cV6v7c egO7ur2qc9HtuvugxfHGcIWOJMRaOEMNUC7EnC78BtkXFjgq6kQoly++q7xELwqm7iYc FR0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=vZvD55Of; spf=pass (google.com: domain of linux-kernel+bounces-8808-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8808-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d25-20020a1709064c5900b00a23480119e0si1038944ejw.312.2023.12.21.09.01.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 09:01:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8808-linux.lists.archive=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=vZvD55Of; spf=pass (google.com: domain of linux-kernel+bounces-8808-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8808-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A31481F241E4 for ; Thu, 21 Dec 2023 17:01:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5395A5822B; Thu, 21 Dec 2023 17:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="vZvD55Of" 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 C14276AD6; Thu, 21 Dec 2023 17:01:08 +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=B4CQ1XhxEhN3/jq/xBpStBFHE0rLx7trdKlpNSEDOVc=; b=vZvD55OfvJcd3C21Muin8ZLNRo VVJGYu17KwmOHoYeEnmk5FlLXdTBM151MzreMNqblqV4T5N9HYA6spMabH2nw22QKiXURcwzgtGWm oGWoatN4bBY20+KvF6ZXh4KXGghdeuFsvkpdcN99HW932CpAgeEprsHSWBZxgFL9icug=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:58656 helo=pettiford) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGMPr-00076l-6X; Thu, 21 Dec 2023 12:00:59 -0500 Date: Thu, 21 Dec 2023 12:00:58 -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: <20231221120058.adb45fd82ff054d29f1f1972@hugovil.com> In-Reply-To: References: <20231219171903.3530985-1-hugo@hugovil.com> <20231219171903.3530985-10-hugo@hugovil.com> <20231221114103.557409e9875a0f2f95eacfb6@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 Thu, 21 Dec 2023 18:55:17 +0200 Andy Shevchenko wrote: > On Thu, Dec 21, 2023 at 11:41:03AM -0500, Hugo Villeneuve wrote: > > 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: > > ... > > > > > - 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? > > > > 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. > > For current models of the device, yes. Who knows the future? > Also, ARRAY_SIZE() make it less points to update if ever needed. > > > But I can change it back to ARRAY_SIZE(irda_port) if you want. > > Please change it back. > > > > > return; > > ... > > > > > + 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. > > Let's remove. We can add it back in case something like this (quite unlikely) > happens. Ok, will do both for v2. Hugo Villeneuve