Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp404062rwi; Mon, 31 Oct 2022 03:00:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56vaoAOMKrAdfO9W08MCLWoIaabud+rC6weEZulxU4uzxzFy+wUlQ/1ogfJPGNfSIgNTw4 X-Received: by 2002:a17:902:e5c1:b0:186:897f:b8ee with SMTP id u1-20020a170902e5c100b00186897fb8eemr13398776plf.151.1667210442993; Mon, 31 Oct 2022 03:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667210442; cv=none; d=google.com; s=arc-20160816; b=BCZob9XteCRs5IyXHVWWmKf4olLCgCHQSuO3JtDKWEFURMgPfM17TYCClpZ8Jc7Ho3 R7LL3/UYrUc5pEo4VC6iVsH2VEkeOMpuc705AEq31XCqR8btBFFcsaTGs372622gSh8n frKynRIJAVXigCS2/V0o2QzZQsX2xjMwHn9OtJTcpB+cTm/zaoYtBoOmXFkHBjoxHL7x mtPSxcMDw0kbjdjUZoKXVB4wAdvudefSWjCpcUbmDJZ1maUOlK7H37KCYlmy/5mFyv0Z M6l7UvXOnN2Tg8Vn8Elr4cQm60uvv/izvI3/dg0HgGsQFWGPkEnGTyquZBGuSqfhfnW0 ZqJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BgH8mxCAnRmUWRSYgXY56JEek3sbSrE4xdTshaq9ANs=; b=z9M+Ci8nXdqd4a4m66EvFEbccvrppTo0ua6obyAFYKJHrDs73WhStBYXean/oRqcvf s0K/9LgMuM9li0xRi9lDgY8ErskB1BlK+ZTt1dJDI8+S4Ck5s7xGSk5zLwCAIUM4aew3 2Eqq8AMp+A88d4z5ciP6mp/0rsGVIUprzSCta4lL5L2Cmvs7oHDRii0MWxQJ67CUIZou Qj3bAfFmACl29QrlrLV5HXcJHGB0JgOguVmwLKtSxSqMCMECLSlZCeu4W0i7I6PAfOQv s/UuOCjq3cr3WBPu9JalnRUSLn9JKKNCINR5jLlQZAMTrMzK7OoRG48HYlgITKVrpB5m 9D0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=J7YIHtuc; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f31-20020a63555f000000b0042ad28ace95si8688919pgm.832.2022.10.31.03.00.29; Mon, 31 Oct 2022 03:00:42 -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=J7YIHtuc; 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 S229889AbiJaJkx (ORCPT + 99 others); Mon, 31 Oct 2022 05:40:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiJaJkv (ORCPT ); Mon, 31 Oct 2022 05:40:51 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D40AC76C; Mon, 31 Oct 2022 02:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1667209231; bh=a+WIKnAu+RfBS8xAhnVFlou+k5sPVUzbUASFir5UywE=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=J7YIHtucgVQs5XeLE3fSzmebQwMd8kG6DGIl9rmq7sn2M2iDrc19+nmrDu+XICLcR vkXaUFI1j6kjEuy+hHZ6uS52c5bK8pw1y99axzVfrxl1mFhy/+9G6kfyNGzwCokGO4 caD4WhkrggM9CzT3IFUv5iPOXGg8mSs8QyKXgqtU= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via [213.182.55.206] Mon, 31 Oct 2022 10:40:31 +0100 (CET) X-EA-Auth: lAZr++KF+w2MI+M5dywmZDcNBi/iIf9moMfunGMLSjl93wm+/oWRBqiQq+UbqyamMAImkSTlHW5vtcAUZmY1a3CI3ZtFIbPW Date: Mon, 31 Oct 2022 15:10:27 +0530 From: Deepak R Varma To: Julia Lawall Cc: Greg Kroah-Hartman , outreachy@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Mon, Oct 31, 2022 at 12:41:40PM +0530, Deepak Varma wrote: > On Sat, Oct 29, 2022 at 07:34:26PM +0200, Julia Lawall wrote: > > > > > > On Sat, 29 Oct 2022, Deepak R Varma wrote: > > > > > On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote: > > > > On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote: > > > > > 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(-) > > > > > > > > > > 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__ })) > > > > > > > > Please please please test-build your patches before sending them out. > > > > To not do so just wastes reviewer resources :( > > > > > > Hello Greg, > > > I did build the .ko files by making the driver/staging/fbtft/ path. I verified > > > .o and .ko files were built. > > > > > > I did a make clean just now and was again able to rebuild without any errors. > > > Please see the attached log file. > > > > > > Is there something wrong with the way I am firing the build? > > > > The change is in the definition of a macro. The compiler won't help you > > in this case unless the macro is actually used in code that is compiled. > > Find the uses and check for any nearby ifdefs. For file foo.c you can > > also do make foo.i to see the result of reducing ifdef and expanding > > macros. Then you can see if the code you changed is actually included in > > the build. > > Okay. This is helpful. I understand. Looking into the file where the macro > expansion is reported to be failed. Hi Julia, I could see the macro expansions in the .i files for the fbtft-core.c and fb_hx8353d.c file. I am not sure why it built successfully on my x86 though. The error in Kerbel bot seems to be specific to ARM arch. I will try that later today. I am on the right track to the build error triage? Also, while reviewing the macro expansion, I saw change in the computation that seems odd to me. In the denominator of the expanded macro, there is a "+ ((int)...." computation that I am not sure if is result of ARRAY_SIZE. I have attached the old anf the new .i file diff for your review. If you get a change could you help me understand why this additional computation is added to the denominator? Thank you, ./drv > > Thank you, > ./drv > > > > > julia > > > > >