Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1975584rwd; Mon, 15 May 2023 05:51:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6w5huqj08DDNolt7FZzvV0zASL7C6Ydsj7Z/HgRv5DtHZkCmoyswBm50pkl3OPNkOumtYP X-Received: by 2002:a05:6a20:7295:b0:ef:205f:8184 with SMTP id o21-20020a056a20729500b000ef205f8184mr42803592pzk.13.1684155073199; Mon, 15 May 2023 05:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684155073; cv=none; d=google.com; s=arc-20160816; b=Y903Ws2JOo6iqok2/mQEZFi6daTuZuaP9G9cWCl7hYAvBRkHr9Qg7jtnQiUQm55KX6 1AQVEQnEwrRk2AP1JhCVjukSjINGxu6pt738AHrBIfnlovOdp+myaLJz3k8b94FkR6uG VLHh+QEYLf9t6ZwbiwKs/GZe3nQVPmwYcy8X/y6MQblHqYJE9rpYtDUBmcbcHPNk2mLR YO+TdPQB8jjj/xPs4iNUpT5mPXUa8ufildRf2gV3YnroJbOq50Ycn/bUT7p8EZ2dh4EO DI1XrQTVLEk77xAjxG2LtMhEdZM4RSBt/tAUkxs1xw3tCMn2aRBr87z8hgWECoAGHTma bzuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=V8KynlLdWt3UJGTFqIxxFp7r5l9ZBF4QS1k2g/OVCrk=; b=rWCi+OT1z9dlzSRQI5h4xWNxsnKmevKF3y36iHYYnh0ZgYgFONl9dxgy/SCauS3lYT bwmTaQT6+wm25ViP4ywrW9Fi4nmUlb3LMqD8NHlrVILkTLh5cft5WVEZwxCDqvvMpBgR n8KZFpLxMKib8oQeAGztPWinnl02BNg+SHGF0gCVW3W9Bh9u0+F2LKzxAvw7J15H3I/z tK5t9IQAJTPJacbl0zKjvsmzN1Qpe8+iI27E8foa4MlgEtRlq8h/9EcJFwKa8WCV7pnL EW4q/60MLJo77aVBZO1hcr+qG0LiGi1+l0OPpoIpPShNNRjk0Fyy7B8hRrFJZC7X5ca6 ofJg== ARC-Authentication-Results: i=1; mx.google.com; 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=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs9-20020a632809000000b0052c910d862fsi15340496pgb.244.2023.05.15.05.50.58; Mon, 15 May 2023 05:51:13 -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; 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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241389AbjEOM33 (ORCPT + 99 others); Mon, 15 May 2023 08:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240173AbjEOM32 (ORCPT ); Mon, 15 May 2023 08:29:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8EF96E4F for ; Mon, 15 May 2023 05:29:26 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 071914B3; Mon, 15 May 2023 05:30:11 -0700 (PDT) Received: from [10.57.83.155] (unknown [10.57.83.155]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 778B53F663; Mon, 15 May 2023 05:29:25 -0700 (PDT) Message-ID: <3a8ec4a6-625c-ba3e-06aa-f8a30d2170d2@arm.com> Date: Mon, 15 May 2023 13:29:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH] perf/arm-cmn: fix compilation issue Content-Language: en-GB To: Liming Wu , Mark Rutland Cc: "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" References: <20230515012930.946-1-liming.wu@jaguarmicro.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 2023-05-15 09:35, Liming Wu wrote: >> The kernel builds as gnu11 (i.e. C11 + GNU extensions) since commit: >> >> e8c07082a810fbb9 ("Kbuild: move to -std=gnu11") >> >> ... so that warning shouldn't be happenning. >> >> How are you triggering this? Have you modified KBUILD_CFLAGS? > > Thanks for reply. > This error occurs for I compiled the arn-cmn module separately. You're free to build bits of mainline against older kernels if you want to and can make it work, but understand that what you're doing in that case is a backport. It can be expected that some things need adjusting when backporting, and this happens to be one of them; go back far enough and the irq_set_affinity() call would be another, IIRC. The code in mainline here is correct for the mainline kernel, so there is nothing to fix. Thanks, Robin. >> -----Original Message----- >> From: Mark Rutland >> Sent: Monday, May 15, 2023 4:31 PM >> To: Liming Wu >> Cc: will@kernel.org; linux-arm-kernel@lists.infradead.org; linux- >> kernel@vger.kernel.org; robin.murphy@arm.com >> Subject: Re: [PATCH] perf/arm-cmn: fix compilation issue >> >> On Mon, May 15, 2023 at 09:29:30AM +0800, liming.wu@jaguarmicro.com >> wrote: >>> From: Liming Wu >>> >>> This patch is used to fix following compilation issue with legacy gcc >>> and define variables at the beginning of the function >>> >>> error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode >>> 2098 | for (int p = 0; p < CMN_MAX_PORTS; p++) >> >> The kernel builds as gnu11 (i.e. C11 + GNU extensions) since commit: >> >> e8c07082a810fbb9 ("Kbuild: move to -std=gnu11") >> >> ... so that warning shouldn't be happenning. >> >> How are you triggering this? Have you modified KBUILD_CFLAGS? >> >>> Signed-off-by: Liming Wu >>> --- >>> drivers/perf/arm-cmn.c | 13 ++++++++----- >>> 1 file changed, 8 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index >>> 47d359f72957..2299fcde5b4a 100644 >>> --- a/drivers/perf/arm-cmn.c >>> +++ b/drivers/perf/arm-cmn.c >>> @@ -2009,8 +2009,11 @@ static int arm_cmn_discover(struct arm_cmn *cmn, >> unsigned int rgn_offset) >>> u16 child_count, child_poff; >>> u32 xp_offset[CMN_MAX_XPS]; >>> u64 reg; >>> - int i, j; >>> + int i, j, p; >>> size_t sz; >>> + void __iomem *xp_region; >>> + struct arm_cmn_node *xp; >>> + unsigned int xp_ports; >>> >>> arm_cmn_init_node_info(cmn, rgn_offset, &cfg); >>> if (cfg.type != CMN_TYPE_CFG) >>> @@ -2067,9 +2070,9 @@ static int arm_cmn_discover(struct arm_cmn *cmn, >> unsigned int rgn_offset) >>> cmn->dns = dn; >>> cmn->dtms = dtm; >>> for (i = 0; i < cmn->num_xps; i++) { >>> - void __iomem *xp_region = cmn->base + xp_offset[i]; >>> - struct arm_cmn_node *xp = dn++; >>> - unsigned int xp_ports = 0; >>> + xp_region = cmn->base + xp_offset[i]; >>> + xp = dn++; >>> + xp_ports = 0; >> >> None of these are for loop initial declarations. Even if we wanted to avoid the >> warning, there's no need for these to change. >> >>> >>> arm_cmn_init_node_info(cmn, xp_offset[i], xp); >>> /* >>> @@ -2095,7 +2098,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, >> unsigned int rgn_offset) >>> * from this, since in that case we will see at least one XP >>> * with port 2 connected, for the HN-D. >>> */ >>> - for (int p = 0; p < CMN_MAX_PORTS; p++) >>> + for (p = 0; p < CMN_MAX_PORTS; p++) >> >> This shouldn't be necessary given the jernel builds as gnu11. >> >> Thanks, >> Mark. >> >>> if (arm_cmn_device_connect_info(cmn, xp, p)) >>> xp_ports |= BIT(p); >>> >>> -- >>> 2.25.1 >>>