Message ID | 20230412124737.2243527-8-vladimir.oltean@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp300364vqo; Wed, 12 Apr 2023 05:52:40 -0700 (PDT) X-Google-Smtp-Source: AKy350Zj9R+BSm0FK+AJ+oN3rFYbwH2XHNmMELIVr6wf0anJr2WNAxwImCpW5DH7L7GD1qzkdyi/ X-Received: by 2002:a17:90a:1c8f:b0:23d:4a40:e794 with SMTP id t15-20020a17090a1c8f00b0023d4a40e794mr3030160pjt.10.1681303960012; Wed, 12 Apr 2023 05:52:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681303959; cv=pass; d=google.com; s=arc-20160816; b=TKKV0bLwTfYypV8w4pgTgGXjoah/yJoEFFLCH6ABMNki7ljORTAGVr/TIQ5EYMVgAI 12dsurjInMBLsDoD8rfy1fzs8oM6IntmD+JTbMKVIxmy15hCV7uHMraDhlHTCGcMOhrq cnEY3f0C9BBRmlHnxXBYy2hV3RMSVLcArrl4vjf4Jy7r+RlKhBAXDBEy41vMhGE42N01 RFO0InmSxrAWXfvjygRoGogVFk8hdThLOKhIAqqbkMmccDtTYMLjySsKH1G+WWtLBEpj bGea1kcwLZaMoc55BZfsrKvdQSoT0t6Q0oP6lY+AUiyjrWZ0Qubhiz4/I+5b7rJ65pFM +7ZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x0dzRqtPSO85rjzAqEo8rc0SJ1W5x9A0rEVVF5pPY4M=; b=A7WGzGoCoVsKzlSC19zctOOEXCfuDXHY/v1O2wFwQ1jJbfsFzwxTEVzSJJBQLtqn3e /5PfDI6hPtAfcYzU3Ay+15qvJoA/Kvqw19eSUww4M9gRnFPRlAGKwhLfh0JRF3jmaC8q GlgNLvW+FshC2zeMQwFttUv76LKSQVj3evUH8THxsPIuYQ/lQtgkR/l2ddxpx1HWpMYs T5qF36e07oU1rN/CqMbj9a4Eg3IQGj9r8uuRelIC2z4Bxn+A7WbDPX2lfEPjmF1r5RyR u+Rwmbh6zHw/bKWJ7LZBDHkI3lL9u4IuLWYlvz+JKc2FSrzWMOT3ZdCh5yEA1eY5WtyR aJTw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="P/wrJAh+"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a17090a950500b0024664356ef7si1814770pjo.152.2023.04.12.05.52.27; Wed, 12 Apr 2023 05:52:39 -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=pass header.i=@nxp.com header.s=selector2 header.b="P/wrJAh+"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231377AbjDLMuo (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Wed, 12 Apr 2023 08:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjDLMuR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 12 Apr 2023 08:50:17 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2071.outbound.protection.outlook.com [40.107.22.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 535A29F; Wed, 12 Apr 2023 05:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jwQVAFCjtwrbnaApOPFK6LFOhqErZw/7pq8kVxub8G7NeDXd+EbbILgT2RnHwxc7Lbjd4td8IBaLtFf9F8FbFbj+xDfllq7ZGHcTxa6Xjyx7XwJiIBAq6Yycypu/b4kLF/Z6vN7ZSxDvztXBbkWhlGn9XehQ/IjmFi+GZhEOs0joKlHb3PO9ctLqKg0UpHjnYu/miu2flrrx5LbA9b0EEPllxPu2XhlzzlM2HL1ftTEIvXA6W7Pu4ojw7f63ooeFwE4XfbdEvV8G4j2I2E8I2NgXgGcqhMx+XpYHHxYjAf0q7jemUBWQh70Vu+pBZ6xa9JapHluAqeM2uMBmdKqANA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x0dzRqtPSO85rjzAqEo8rc0SJ1W5x9A0rEVVF5pPY4M=; b=Q6xBlLrddJwcw+XrdVXmSCPrXNvzoecTIxegDOlflIPiMj2etAQhBewoLl6kdxzSC+2lV5QNP6KT5hCPG9PgNTVYRZXlvhdgdV1hzxo6tq8fPi8vH81FbojYLZLuRNNIZtEzVvCloXhemQXGDnJ4M0QyidfTkeQ2i06BRTN+IkzX/xQMS8jC9/gAmoOMj1eajXEgUa1b6fqXwym97lWz3guzBPqGSk1KmglIdv1U20rwP19XqUHSREVdkqngTlQNiACNtBOYsyHyxcWr6qbnIwo0nHT53bqrR1N8hlxQEOaCt0RE/zE9zcsZEfGG0OJWIN7SMlf/+MvCUh6Pd5bhhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x0dzRqtPSO85rjzAqEo8rc0SJ1W5x9A0rEVVF5pPY4M=; b=P/wrJAh+dFMmvFN90M1G93o6RIPXvdelEWjYmItZy7oiP08Ngiwu0+7zIS80iv8MvUAqzviYk2Td6t9EVNl0HIz9D48FhM+T1I/l5pjn4hpVhaMILAEFxZIEDmvKkWlUgPbp43RlUXq60m6JhHdFlFjzK5nibugzyTZhcx3k0xM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:59 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:59 +0000 From: Vladimir Oltean <vladimir.oltean@nxp.com> To: netdev@vger.kernel.org Cc: Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Claudiu Manoil <claudiu.manoil@nxp.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, UNGLinuxDriver@microchip.com, Colin Foster <colin.foster@in-advantage.com>, linux-kernel@vger.kernel.org Subject: [PATCH net-next 7/8] net: mscc: ocelot: strengthen type of "int i" in ocelot_stats.c Date: Wed, 12 Apr 2023 15:47:36 +0300 Message-Id: <20230412124737.2243527-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f8d8014-7a77-4d6c-be60-08db3b54252e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xQlkxqbmf112VmdEIT63tOyXzcG3sJ99GN/6ABkm31zkjXij2B7LKRvEWxXzla6EkXIs6t4n3M4DIRN+82RjbDCok4D9/bcjP5FdrVMqeKdYUm+7RdhDYXLI5I0TZ8lnLRtZYj1Nevt0vK98kWeTIOb09EiY/Rw2D7/Q/biZ+tzQ0AaTbly+T+dm//qOj1GiDqFCLIvPx7XGC/e+YRViMqOHzBvTEX0JVEheS6YA7Z1DYMHV4eJncJs+nKFxXUFWm+qB/adVgu3Iy7ZG+eO2+bLmsJlu/B8mB9GFWyE3l9d2KCgdHzGhZ9RQMh9eTJhErDDGi6RlP++FXSeeeTaH3z0jsRqMHE+3xAUAqxGKz3bnljjvVI5IuvxrT/OZoGNrsJp4RNCNWF2C75qKqDlZu2fC9vADm7X7ToLvBlCAfTf5tx0u7LtcSPgUXrEwYCPMzqfLPozowI/nif6nJWwVaq/elTV/KX3Kw8soNmygnatF40ns7ZF2zhJdtJjoNp/r/Ylk9e1dLjNPSlH5/VzmmtJkr67yXTrQsCLz0SX4YQnyqcelaXh81zmzfNM6MFB3C6aDo89/AclRYOe8yJLA/qacYmtihB/xBZXlzRSUovLOWdFLUSMlU2tCjavWjW9E X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iVgiBARO8K1FAnB8J8k5WgUB+N2YZ9XSbwMOPCEGw3yJVat1Qy4KsHETJGy401rk/0Eti9vFD73GpVnj20AcZyQm+1HIdvubt4hx/O160CfJkE0DOlhLi1qouADAzflMUZ+meEiObxcCOIkTBKqy/n7qZa8h8iyH3WhNcx1X2aRCS0Hx/vKvL4MLj8NBg7dcH4CHjEVXUNsFu1E2aEA367z3oX5iyue+Mz1ZzXxABipUTPuxzdIUgzcHyBycfVcJ5MunhvnbksJxCspEQqa67p9ZTp+kjLjMwSzsHua8eJCpVvY6brokHTFVQkL8DwEzMngFCqKMKNMHmjEyMVGDJVbluOndevXmpIIe32fBkXFZaiSXJMQ5qOfMVe4tIV+PXY31HqOHSjq2xpCJj7b6Il5Xls1dEI7mR9R/7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uCna0zuzIJVgscFXUYrQDjTZNZY0skbuxDbG20AJydzEQSgWveiJee8/keDUbNk85z+KgTArOipn9HOKKpICee3/751loNjyAMEPDVOy2mmW5NeCvYBR0o00uHA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f8d8014-7a77-4d6c-be60-08db3b54252e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:59.2064 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iaRinoSMQnHBn+96J6O8PhbLgYHZSx/2MzdLdVqEr8Jr8pI2nxc3i6LhjQrmOLruG/5TVSoiiW/Fof0Tc0AS8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762974981083494041?= X-GMAIL-MSGID: =?utf-8?q?1762974981083494041?= |
Series |
Ocelot/Felix driver cleanup
|
|
Commit Message
Vladimir Oltean
April 12, 2023, 12:47 p.m. UTC
The "int i" used to index the struct ocelot_stat_layout array actually
has a specific type: enum ocelot_stat. Use it, so that the WARN()
comment from ocelot_prepare_stats_regions() makes more sense.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
drivers/net/ethernet/mscc/ocelot_stats.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Comments
On 4/12/2023 5:47 AM, Vladimir Oltean wrote: > The "int i" used to index the struct ocelot_stat_layout array actually > has a specific type: enum ocelot_stat. Use it, so that the WARN() > comment from ocelot_prepare_stats_regions() makes more sense. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> > --- > drivers/net/ethernet/mscc/ocelot_stats.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > For the lazy readers who didn't dig up the source outside the patch context, the WARN in question is: > > /* enum ocelot_stat must be kept sorted in the same > * order as layout[i].reg in order to have efficient > * bulking > */ > WARN_ON(last >= layout[i].reg); Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index a381e326cb2b..e82c9d9d0ad3 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -395,7 +395,7 @@ static void ocelot_check_stats_work(struct work_struct *work) void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data) { const struct ocelot_stat_layout *layout; - int i; + enum ocelot_stat i; if (sset != ETH_SS_STATS) return; @@ -442,7 +442,8 @@ static void ocelot_port_stats_run(struct ocelot *ocelot, int port, void *priv, int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset) { const struct ocelot_stat_layout *layout; - int i, num_stats = 0; + enum ocelot_stat i; + int num_stats = 0; if (sset != ETH_SS_STATS) return -EOPNOTSUPP; @@ -461,8 +462,8 @@ static void ocelot_port_ethtool_stats_cb(struct ocelot *ocelot, int port, void *priv) { const struct ocelot_stat_layout *layout; + enum ocelot_stat i; u64 *data = priv; - int i; layout = ocelot_get_stats_layout(ocelot); @@ -890,7 +891,7 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) struct ocelot_stats_region *region = NULL; const struct ocelot_stat_layout *layout; enum ocelot_reg last = 0; - int i; + enum ocelot_stat i; INIT_LIST_HEAD(&ocelot->stats_regions);