From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFC13C433DB for ; Wed, 30 Dec 2020 12:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACF4C2220B for ; Wed, 30 Dec 2020 12:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726710AbgL3Mjl (ORCPT ); Wed, 30 Dec 2020 07:39:41 -0500 Received: from smtprelay0108.hostedemail.com ([216.40.44.108]:56798 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726547AbgL3Mjk (ORCPT ); Wed, 30 Dec 2020 07:39:40 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 1762E1730840; Wed, 30 Dec 2020 12:38:59 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: field67_0e06870274a5 X-Filterd-Recvd-Size: 2547 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Wed, 30 Dec 2020 12:38:58 +0000 (UTC) Message-ID: <9defa63ffed0e526269672776c94eca36af6afae.camel@perches.com> Subject: Re: [PATCH v3] checkpatch: ignore warning designated initializers using NR_CPUS From: Joe Perches To: Peng Wang , apw@canonical.com, Andrew Morton Cc: linux-kernel@vger.kernel.org Date: Wed, 30 Dec 2020 04:38:56 -0800 In-Reply-To: <5d4998aa8a8ac7efada2c7daffa9e73559f8b186.1609331255.git.rocking@linux.alibaba.com> References: <5ca6c2d28f6cf091a676f8e7d8f14a933da0b267.camel@perches.com> <5d4998aa8a8ac7efada2c7daffa9e73559f8b186.1609331255.git.rocking@linux.alibaba.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-12-30 at 20:29 +0800, Peng Wang wrote: > Some max_length wants to hold as large room as possible to > ensure enough size to tackle with the biggest NR_CPUS. > An example below: > > kernel/cgroup/cpuset.c: > static struct cftype legacy_files[] = { >         { >                 .name = "cpus", >                 .seq_show = cpuset_common_seq_show, >                 .write = cpuset_write_resmask, >                 .max_write_len = (100U + 6 * NR_CPUS), >                 .private = FILE_CPULIST, >         }, > ... > } > > Signed-off-by: Peng Wang > --- [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -7028,12 +7028,14 @@ sub process { >   >  # use of NR_CPUS is usually wrong >  # ignore definitions of NR_CPUS and usage to define arrays as likely right > +# ignore designated initializers using NR_CPUS >   if ($line =~ /\bNR_CPUS\b/ && >   $line !~ /^.\s*\s*#\s*if\b.*\bNR_CPUS\b/ && >   $line !~ /^.\s*\s*#\s*define\b.*\bNR_CPUS\b/ && >   $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ && >   $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ && > - $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/) > + $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/ && > + $line !~ /^.\s*\.\w+\s*=\s*.*\bNR_CPUS\b/) >   { >   WARN("NR_CPUS", >   "usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); Thanks. Acked-by: Joe Perches