Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1706565rwd; Mon, 15 May 2023 01:41:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4QJ9gJqgHTVvI4o5RMI7bzypTIKNmVN3MOValw0CbV8CbcApDta1PtNUj9z+X3tQ75R29o X-Received: by 2002:a17:902:c115:b0:1aa:d866:33cf with SMTP id 21-20020a170902c11500b001aad86633cfmr33598011pli.56.1684140117491; Mon, 15 May 2023 01:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684140117; cv=none; d=google.com; s=arc-20160816; b=xQ7fAS7JOeruW2Y8QXDQaAMb8hq8n9QIawFmVlzuaBVTowkn+W27H/77EbP5+eMszy jaaxmE8OAKOY/OTvljfaUR0ozjRPPvZZjTD+jIMp9VLQKt857Imohm4kXdWGOX9T8pmb OLpRLKlr2LVR+NlcUz8nE3tpKo8Huj3dXWJOBqEWwL40mQS/zQJsSppzgqzE6+VdNKRQ JBLAtPhK1HSQazGkCb4bEh6ykyjumo5iRjx8fHghbHqJTkQ8pheolcAhlFa1aRIkjhUU O89STX2vZy5OPm4tpwNDZHX9lRMdPfeOKgHmvMP2+J3SekZHU2gSEjahD14VJeTcxXbp m0Gg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2LcCHnzCuOE1s2i5a+yBnV6Azj0L6lACPuPVMm6ek6M=; b=gyR6wkrn3oC5ZgFLNu0o+3evq8FWINEysGV1e0XPaBtZVd3xCXp0L1xDPEbNo6dYD+ pJR9zCggBbyFzl0aBvPH+cVclc5KXyMIYthdTeYECtZXkupWwt8m+z02GwY1jSXNVP1U 3fFGXvOjc2UogqDTWhb9PtX19qV3WlRxpSkR8mEexIRgAEK2ZlzvCSLClWUfiuWxXeam eTqdzYnen+jCgOpQDB4QTqnm1D2vHIuziDSLXHKxwzQYeEE1TRBnzYKQgRO1E1zm2Dno L2HHRWXcKqF7/XRL1tNFsqqYX9AeQdXbI6wFZDFCoQH5L4TveVKM/ku8xETIqMkCOx4F qPHQ== 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 n11-20020a170902e54b00b001acb03ca5aasi15407544plf.612.2023.05.15.01.41.43; Mon, 15 May 2023 01:41:57 -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 S232319AbjEOIcZ (ORCPT + 99 others); Mon, 15 May 2023 04:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232477AbjEOIbo (ORCPT ); Mon, 15 May 2023 04:31:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B537619B0 for ; Mon, 15 May 2023 01:31:36 -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 E380A2F4; Mon, 15 May 2023 01:32:20 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.59.142]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 49E073F67D; Mon, 15 May 2023 01:31:35 -0700 (PDT) Date: Mon, 15 May 2023 09:31:25 +0100 From: Mark Rutland To: liming.wu@jaguarmicro.com 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 Message-ID: References: <20230515012930.946-1-liming.wu@jaguarmicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230515012930.946-1-liming.wu@jaguarmicro.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 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 >