From patchwork Sun Mar 7 17:59:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 12120893 X-Patchwork-Delegate: nbd@nbd.name 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=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 DFC65C433DB for ; Sun, 7 Mar 2021 18:00:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3742650E6 for ; Sun, 7 Mar 2021 18:00:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230111AbhCGR7j (ORCPT ); Sun, 7 Mar 2021 12:59:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:59968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbhCGR7O (ORCPT ); Sun, 7 Mar 2021 12:59:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 26A5F650F5; Sun, 7 Mar 2021 17:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615139954; bh=pkUXhAepp54hgcKyVXZ/4o7VGcce5SlP3XWGz0JIr7s=; h=From:To:Cc:Subject:Date:From; b=EgRL+h1B1zhIbQ9kIa3vg8Z3R/ByoGXXbVmltRzoCepE8Jj835RxwKRpDMo1EFDby sp4xH8LAwMbwJbedB7DVWYvscAKeBznVBt+7DV4yjuYAnQLjr1sv046CXgI6EE/Lvq nd68o+ofj03k/QLJdY8HpPYXhdC0n5iBIxY8QDc0bEV3RcN+fes6WwhD4RRWzePBMo TVbfoZIcSkgVd2SVTMJDwgt0v4kQXirhbKZ2wYsw6PpIBy83tLWQ7fLJ4Z21Y5sIep +TNTVzq2kZ/dcsS+OcAijRi9fy6UKbAFNxxbFNtqSSCUYI1HTFp3fEABL5cTLO/Tl1 s/i9A2HPQgWeg== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, ryder.lee@mediatek.com Subject: [PATCH] mt76: mt7915: simplify mt7915_mac_sta_poll routine Date: Sun, 7 Mar 2021 18:59:08 +0100 Message-Id: X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Drop unnecessary lock around sta_poll_list list in mt7915_mac_sta_poll routine. Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index b3168dd3baed..cde98b86e2bb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -117,23 +117,15 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) rcu_read_lock(); - while (true) { + while (!list_empty(&sta_poll_list)) { bool clear = false; u32 addr; - u16 idx; - spin_lock_bh(&dev->sta_poll_lock); - if (list_empty(&sta_poll_list)) { - spin_unlock_bh(&dev->sta_poll_lock); - break; - } msta = list_first_entry(&sta_poll_list, struct mt7915_sta, poll_list); list_del_init(&msta->poll_list); - spin_unlock_bh(&dev->sta_poll_lock); - idx = msta->wcid.idx; - addr = mt7915_mac_wtbl_lmac_addr(dev, idx) + 20 * 4; + addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx) + 20 * 4; for (i = 0; i < IEEE80211_NUM_ACS; i++) { u32 tx_last = msta->airtime_ac[i]; @@ -152,7 +144,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) } if (clear) { - mt7915_mac_wtbl_update(dev, idx, + mt7915_mac_wtbl_update(dev, msta->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); }