From patchwork Fri Oct 28 13:30:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 12272 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp835656wru; Fri, 28 Oct 2022 06:36:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PaGuvvevlwMZKQcAmY7HPwofEru7CWlquLBtecrurJEASGEo8BCxsKR/imupl9MUNGwlU X-Received: by 2002:a63:2c8:0:b0:46e:9da9:8083 with SMTP id 191-20020a6302c8000000b0046e9da98083mr36576248pgc.186.1666964198995; Fri, 28 Oct 2022 06:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666964198; cv=none; d=google.com; s=arc-20160816; b=icwQ4p8VL1TDmOofvw/JPuZGwOG4XTh3Jfpeo7LpfWgaSp3kdTKYga3cU9vLx8P2If GFkQNJChW8Y3qawVlEiIbZYZyYB/gneHfFPqYCItfw/SEJoYB2jeC3X+E+Ct0MApekx1 /JfytY8LuRfeUGpmPunoRE4U+eM2AEQnQ66Kgtn0KxmdO5znWleWbyvZqe/Yd4hkSKcC qtFrsTYjQPeVMsMYKJkuhhO6/ZG9zJumTeOo6b2vVOS9zgKnOhGXddWpgAF+UcC7+WCB SM1ImCwXenIXzZ/3kSOdQyJO6oBupbptP8O3mwffnWgEEmYoL2R95zlO+v9m/zicAoZX /yiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=b8fMrZCovOvFP8BqzGtNjmTS24CKg/OaZJYL0rVR0AQ=; b=f861gAuMcNlR4uR5xj8Leq5EHje602S9vmdDSynBZ+nkM7H4osaA7vpftVzE8eAXjE syXtxN95/Xb+5OlenMmSI4UCjzb71kFEsBMjCKgXUfKrFhaz7+R6mf+rY0NVfTvPR7Ng BCZvhzX/B2yUmo1GW/HK3eLvI7ko9IDaXcH4gw9tegWQqVS9GN3V13DvbvV7FFmHEMk9 DhizgWqt8BL058eJKWimMItod0R+HuPYdqjUbCNXxj1cGTh6It+/ohH+hTNC8RvSvt+X i/SM9lXQN5WWWJ9a+OqbctxIS4qt6y6JCv8YztOjKQzyJxytXKlsetIfSVHA94n3Z7rK KZ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=naGIr9mb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u185-20020a6385c2000000b0045fc63bf52csi4617690pgd.764.2022.10.28.06.36.24; Fri, 28 Oct 2022 06:36:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=naGIr9mb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230486AbiJ1Nai (ORCPT + 99 others); Fri, 28 Oct 2022 09:30:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbiJ1Na2 (ORCPT ); Fri, 28 Oct 2022 09:30:28 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8FC5481C6 for ; Fri, 28 Oct 2022 06:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1666963811; bh=yl2gtCFcrA+y8ipJCReQCBstnVYp6kw9Oo6TOGLDu48=; h=X-EA-Auth:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type; b=naGIr9mbGwyhwpjYrv2t87fqffgj1mwZ+5/C4r80b/7MimJ/diBBIj6EkUnpiJmEJ SqFheASo9qXA6Udz4amUxh6XyhqOT0H4SoiBLAbW+ORLUkVGTuQqpHpcnLaVc1hHx8 6huRGOoIvDEfZVfgB1N24jlGlvzir8u96F1Kjaf0= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via [213.182.55.206] Fri, 28 Oct 2022 15:30:11 +0200 (CEST) X-EA-Auth: DIZOiORP0IjVZ8/XwaxKMK586tsbAVcXFYeycjJhdSHO7JpUY2oJpHSxW2jTyOzoxV7UlsyKto2JDACDDTO8hWRBMP/V0mK3 Date: Fri, 28 Oct 2022 19:00:05 +0530 From: Deepak R Varma To: outreachy@lists.linux.dev, Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747938651855426852?= X-GMAIL-MSGID: =?utf-8?q?1747938651855426852?= The ARRAY_SIZE(foo) macro should be preferred over sizeof operator based computation such as sizeof(foo)/sizeof(foo[0]) for finding number of elements in an array. Issue identified using coccicheck. Signed-off-by: Deepak R Varma --- drivers/staging/fbtft/fbtft.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.34.1 diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 2c2b5f1c1df3..5506a473be91 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -231,7 +231,7 @@ struct fbtft_par { bool polarity; }; -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int)) +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ })) #define write_reg(par, ...) \ ((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))