From nobody Fri Oct 17 10:17:08 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BF87C433FE for ; Wed, 19 Oct 2022 13:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232321AbiJSN6u (ORCPT ); Wed, 19 Oct 2022 09:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234079AbiJSNyr (ORCPT ); Wed, 19 Oct 2022 09:54:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D7DE1DDC21; Wed, 19 Oct 2022 06:37:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 068E7B82386; Wed, 19 Oct 2022 08:50:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A77BC433D7; Wed, 19 Oct 2022 08:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169442; bh=NFjboH5Ssva6H4YiEcOPIbsLI+ky7p8zequ7ek/+zBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3pVIZnX0Di40y1c+KHerC/uNdQViD3pLrP+ccidM+IlLY3CLpMK147FHP0N95OYd iXw0OE4F5uFqkaSbKRm1ylYIg+XZp9fpKlFAHs2OUcvfgIePCJxrtvEqQfhzCFGy2V SRiTqkOaA2wZaY0ou9Ocb7CPK+yIY76HNui1jqBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 279/862] wifi: mt76: sdio: poll sta stat when device transmits data Date: Wed, 19 Oct 2022 10:26:06 +0200 Message-Id: <20221019083302.353274253@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Wang [ Upstream commit a323e5f041dd11af5e3de19ed7ea95a97d588c11 ] It is not meaningful to poll sta stat when there is no data traffic. So polling sta stat when the device has transmitted data instead to save CPU power. That implies that it is unallowed the stat_work to work while MCU is being initialized in the really early stage to fix the possible time to time MCU initialization failure. Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wirele= ss/mediatek/mt76/sdio.c index fb2caeae6dba..ece4e4bb94a1 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -478,7 +478,7 @@ static void mt76s_status_worker(struct mt76_worker *w) if (ndata_frames > 0) resched =3D true; =20 - if (dev->drv->tx_status_data && + if (dev->drv->tx_status_data && ndata_frames > 0 && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); --=20 2.35.1