From patchwork Wed Apr 26 20:49:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 87982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp498461vqo; Wed, 26 Apr 2023 13:51:44 -0700 (PDT) X-Google-Smtp-Source: AKy350avJXJNbZaPFFQUqMPVPw3wise9DLVu2tgecqN3e9RaOhVMhROUzYRs136UwjtZefyrPbD+ X-Received: by 2002:a05:6a00:15ce:b0:63d:3411:f9e3 with SMTP id o14-20020a056a0015ce00b0063d3411f9e3mr32729088pfu.19.1682542304227; Wed, 26 Apr 2023 13:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682542304; cv=none; d=google.com; s=arc-20160816; b=TNzneeRHLswZpLxQcgSc72Dar8BezEGg35mbvjNEoV7K4IB6u/CRsUIWBuxQj75amv BaHsqY1IiY0gq5KRo6XhrP/GqOAiOVS7jRKo7Nxk+i4wjl9hsuRYpFIys3dv0f3Eu+AK mMN6lRrOVH09c8vWxqkMgfdO4Ri0tT6lFL9r3wSPYfgs9TGe6n74uprS0+s5SaaMfptZ FXCLKcr3sUgSnvI1emHupiPL7wBNo/7KPHYPJURrnmNd8RwrcZkeArUHnoo45mJudxuy 7TL3yfGK8/PH9G59hSA/hm8jTBKl2CCVMtjRx7C4M5HFpXdVqu8JsWTF9ipbwldyIEwq 5iCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Rd8MEII6gS22N52uLm/8OT5mzUNWj2Lr1oquvlwAI8Y=; b=bv1DjsxByP5F4igbtI6oiX+hNxRP5UpVjRHD+7mZ2bY3FVMiUQvnYt3PhFEU69mD1C EpC6DwpJiNPTyyGix6sS0mtKv603EookvrLpvSMyujZkkK1KBUzS1JK//dtu8cftvT/y /8LJe8iM5qsB2h/bDGQt81rPv0Du0VGsGFjDxZBS72qhbAtWe12bpLoDiCVWGZLLakCH hyWXO24et9O355ouOeJ5n01+eEA78DEC26z3YElswbGFymyiAJfBdNFJO5jiYXAtehN+ z3paErPpFCIdqQOIX7ZMqEPCazP/I2CQvZzN32IH/l2wv9Vn5KZXymkYlyUWa4kcjs1i Wv5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=llYRWeZ1; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a63f953000000b0051b3ea1f2a3si16508534pgk.211.2023.04.26.13.51.26; Wed, 26 Apr 2023 13:51:44 -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=@wanadoo.fr header.s=t20230301 header.b=llYRWeZ1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239904AbjDZUtX (ORCPT + 99 others); Wed, 26 Apr 2023 16:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239891AbjDZUtU (ORCPT ); Wed, 26 Apr 2023 16:49:20 -0400 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B927A273B for ; Wed, 26 Apr 2023 13:49:16 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id rm4bp1ti14BqCrm4bpKuv9; Wed, 26 Apr 2023 22:49:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682542155; bh=Rd8MEII6gS22N52uLm/8OT5mzUNWj2Lr1oquvlwAI8Y=; h=From:To:Cc:Subject:Date; b=llYRWeZ1TtlP7PRM2wkHHJ9r6eDGdOj7BMb52xhXACqlpMY+QR4IGAj3X1fTXAzrT secuIsC9KlnlyiSWoGB7ACzwIt8avoDfilk3BG5Ry81fQbsEaDWHCV4STQ3VPScFOX 9etnPOo0V2hMjPRZ99/uxMw0hYxIeTeT6BYbvgU7otwD4RpBLI0pwbOquxhdbNUygo w8t9TbdjzzS0wjO1CEZdOx/uyUJSkitdTK5ShQsXY0HDENv2qcrsoGM7/PVz/xNjn0 M1LRo7OnaCmrIxWBxHYui8NxIH5ZG5p5yGuyMjAS1ij1t9WhpwYBqmd+AE8zHQBSie 4KHHzL46TCBDw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 26 Apr 2023 22:49:15 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next] wifi: ath10k: Use list_count_nodes() Date: Wed, 26 Apr 2023 22:49:07 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764273479087329249?= X-GMAIL-MSGID: =?utf-8?q?1764273479087329249?= ath10k_wmi_fw_stats_num_peers() and ath10k_wmi_fw_stats_num_vdevs() really look the same as list_count_nodes(), so use the latter instead of hand writing it. The first ones use list_for_each_entry() and the other list_for_each(), but they both count the number of nodes in the list. Signed-off-by: Christophe JAILLET Reviewed-by: Simon Horman --- Un-tested --- drivers/net/wireless/ath/ath10k/debug.c | 4 +-- drivers/net/wireless/ath/ath10k/wmi.c | 34 +++++-------------------- drivers/net/wireless/ath/ath10k/wmi.h | 2 -- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index b9aea1510f7b..f9518e1c9903 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -293,8 +293,8 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb) goto free; } - num_peers = ath10k_wmi_fw_stats_num_peers(&ar->debug.fw_stats.peers); - num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&ar->debug.fw_stats.vdevs); + num_peers = list_count_nodes(&ar->debug.fw_stats.peers); + num_vdevs = list_count_nodes(&ar->debug.fw_stats.vdevs); is_start = (list_empty(&ar->debug.fw_stats.pdevs) && !list_empty(&stats.pdevs)); is_end = (!list_empty(&ar->debug.fw_stats.pdevs) && diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 980d4124fa28..05fa7d4c0e1a 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -8164,28 +8164,6 @@ ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config(struct ath10k *ar, u32 param) return skb; } -size_t ath10k_wmi_fw_stats_num_peers(struct list_head *head) -{ - struct ath10k_fw_stats_peer *i; - size_t num = 0; - - list_for_each_entry(i, head, list) - ++num; - - return num; -} - -size_t ath10k_wmi_fw_stats_num_vdevs(struct list_head *head) -{ - struct ath10k_fw_stats_vdev *i; - size_t num = 0; - - list_for_each_entry(i, head, list) - ++num; - - return num; -} - static void ath10k_wmi_fw_pdev_base_stats_fill(const struct ath10k_fw_stats_pdev *pdev, char *buf, u32 *length) @@ -8462,8 +8440,8 @@ void ath10k_wmi_main_op_fw_stats_fill(struct ath10k *ar, goto unlock; } - num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers); - num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs); + num_peers = list_count_nodes(&fw_stats->peers); + num_vdevs = list_count_nodes(&fw_stats->vdevs); ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len); ath10k_wmi_fw_pdev_tx_stats_fill(pdev, buf, &len); @@ -8520,8 +8498,8 @@ void ath10k_wmi_10x_op_fw_stats_fill(struct ath10k *ar, goto unlock; } - num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers); - num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs); + num_peers = list_count_nodes(&fw_stats->peers); + num_vdevs = list_count_nodes(&fw_stats->vdevs); ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len); ath10k_wmi_fw_pdev_extra_stats_fill(pdev, buf, &len); @@ -8668,8 +8646,8 @@ void ath10k_wmi_10_4_op_fw_stats_fill(struct ath10k *ar, goto unlock; } - num_peers = ath10k_wmi_fw_stats_num_peers(&fw_stats->peers); - num_vdevs = ath10k_wmi_fw_stats_num_vdevs(&fw_stats->vdevs); + num_peers = list_count_nodes(&fw_stats->peers); + num_vdevs = list_count_nodes(&fw_stats->vdevs); ath10k_wmi_fw_pdev_base_stats_fill(pdev, buf, &len); ath10k_wmi_fw_pdev_extra_stats_fill(pdev, buf, &len); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 6de3cc4640a0..6d04a66fe5e0 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -7502,8 +7502,6 @@ void ath10k_wmi_main_op_fw_stats_fill(struct ath10k *ar, void ath10k_wmi_10x_op_fw_stats_fill(struct ath10k *ar, struct ath10k_fw_stats *fw_stats, char *buf); -size_t ath10k_wmi_fw_stats_num_peers(struct list_head *head); -size_t ath10k_wmi_fw_stats_num_vdevs(struct list_head *head); void ath10k_wmi_10_4_op_fw_stats_fill(struct ath10k *ar, struct ath10k_fw_stats *fw_stats, char *buf);