From patchwork Mon Jan 23 10:55:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 645996 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 4A86CC05027 for ; Mon, 23 Jan 2023 10:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231602AbjAWKzu (ORCPT ); Mon, 23 Jan 2023 05:55:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbjAWKzt (ORCPT ); Mon, 23 Jan 2023 05:55:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 616DB1630C for ; Mon, 23 Jan 2023 02:55:48 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 05CDB60E87 for ; Mon, 23 Jan 2023 10:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1576FC433D2; Mon, 23 Jan 2023 10:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674471347; bh=xTRF2Oyj7z5ywXCPFeu28wglIEuDcvhTlbgt5bEXm5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MyFwpRl8K19QF3arH3ULF3MRDtUFcaWKAJuQs+6rZwehJdrWgWyTlUr30QylLVQWS IDqtlbq3NVVkRC7rlxKVvMIfH43KNXtSjGCrczAWP433vu6Hc4saA9U5vieBuwHc6p nhrfZ57vbAzFNfvv5mQTmYAOLHUiqlKuDMEWzO2BPHdIjuYuj5B7vxN5IWLItVkMiN E+reVJ/u6Ces6jY0CxTnuyaqENh3UfYyT8jm5+N6WfwHOax2pHl15gyzUeG3Ja4dFR vcuE0XwZnkT4i+OsHX6IVAsk7gCl5FTdYUsqTFnbNsqRQwCGslc3OX37MfhRQTqMz2 XFODcLCIDiL9A== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com Subject: [PATCH v2 1/2] wifi: mt76: mt7996: avoid mcu_restart function pointer Date: Mon, 23 Jan 2023 11:55:28 +0100 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Run mt7996_mcu_restart routine directly and avoid mcu_restart function pointer whenever it is possible. Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt7996/mcu.c | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index d593ed9e3f73..7983008d74b2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -2247,6 +2247,26 @@ mt7996_firmware_state(struct mt7996_dev *dev, bool wa) return 0; } +static int +mt7996_mcu_restart(struct mt76_dev *dev) +{ + struct { + u8 __rsv1[4]; + + __le16 tag; + __le16 len; + u8 power_mode; + u8 __rsv2[3]; + } __packed req = { + .tag = cpu_to_le16(UNI_POWER_OFF), + .len = cpu_to_le16(sizeof(req) - 4), + .power_mode = 1, + }; + + return mt76_mcu_send_msg(dev, MCU_WM_UNI_CMD(POWER_CTRL), &req, + sizeof(req), false); +} + static int mt7996_load_firmware(struct mt7996_dev *dev) { int ret; @@ -2254,7 +2274,7 @@ static int mt7996_load_firmware(struct mt7996_dev *dev) /* make sure fw is download state */ if (mt7996_firmware_state(dev, false)) { /* restart firmware once */ - __mt76_mcu_restart(&dev->mt76); + mt7996_mcu_restart(&dev->mt76); ret = mt7996_firmware_state(dev, false); if (ret) { dev_err(dev->mt76.dev, @@ -2383,33 +2403,12 @@ mt7996_mcu_init_rx_airtime(struct mt7996_dev *dev) MCU_WM_UNI_CMD(VOW), true); } -static int -mt7996_mcu_restart(struct mt76_dev *dev) -{ - struct { - u8 __rsv1[4]; - - __le16 tag; - __le16 len; - u8 power_mode; - u8 __rsv2[3]; - } __packed req = { - .tag = cpu_to_le16(UNI_POWER_OFF), - .len = cpu_to_le16(sizeof(req) - 4), - .power_mode = 1, - }; - - return mt76_mcu_send_msg(dev, MCU_WM_UNI_CMD(POWER_CTRL), &req, - sizeof(req), false); -} - int mt7996_mcu_init(struct mt7996_dev *dev) { static const struct mt76_mcu_ops mt7996_mcu_ops = { .headroom = sizeof(struct mt76_connac2_mcu_txd), /* reuse */ .mcu_skb_send_msg = mt7996_mcu_send_message, .mcu_parse_response = mt7996_mcu_parse_response, - .mcu_restart = mt7996_mcu_restart, }; int ret; @@ -2457,7 +2456,7 @@ int mt7996_mcu_init(struct mt7996_dev *dev) void mt7996_mcu_exit(struct mt7996_dev *dev) { - __mt76_mcu_restart(&dev->mt76); + mt7996_mcu_restart(&dev->mt76); if (mt7996_firmware_state(dev, false)) { dev_err(dev->mt76.dev, "Failed to exit mcu\n"); goto out; From patchwork Mon Jan 23 10:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 646548 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 BC6CAC25B50 for ; Mon, 23 Jan 2023 10:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231548AbjAWKzz (ORCPT ); Mon, 23 Jan 2023 05:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbjAWKzy (ORCPT ); Mon, 23 Jan 2023 05:55:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6552CA10 for ; Mon, 23 Jan 2023 02:55:53 -0800 (PST) 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 62FDAB80D29 for ; Mon, 23 Jan 2023 10:55:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9D01C433D2; Mon, 23 Jan 2023 10:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674471351; bh=ngpD5EseTABLJd0vL/U87OEOrZWVAoANQaC8NFuWfsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjKFuJ5mGl0jp1lvRyChLD8A+Yk4ZV4quiAYfrGYi7+8A6es8H13XpWoGoC5qhbvN 4/Y1hw9ki+LP5CMs5Zmum5NZb+wq2Y0LgtOILJkiNlpshkaWqjRn5BcLzmahxtbVza lbC2xyJin3Wgetmu8AGupDXsIPeL61+D0ULXi6tefUq4ZBQZMVnhehUhdqrqpXD8uE k0aNmuSDeBdHGX4SOhNUpHPSytfJa4YV4zcTtS807BdRkQNquew6M/EkJY/tLAoWFL 00rC+9mwHRH6oA+Y4ggp1VQA2+ckW4fxC+jT9wQlwqEF6RYoKX5ouU7ygIP5VZ9DHH KTpNRQiq3UzEg== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com Subject: [PATCH v2 2/2] wifi: mt76: remove __mt76_mcu_restart macro Date: Mon, 23 Jan 2023 11:55:29 +0100 Message-Id: <38bf65383048aaafe310d952c592d8ea5542ee9c.1674471203.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org __mt76_mcu_restart is no longer used Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 2efe4db63958..f4e13fbffc54 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -888,7 +888,6 @@ extern struct ieee80211_rate mt76_rates[12]; #define mt76_mcu_restart(dev, ...) (dev)->mt76.mcu_ops->mcu_restart(&((dev)->mt76)) -#define __mt76_mcu_restart(dev, ...) (dev)->mcu_ops->mcu_restart((dev)) #define mt76_set(dev, offset, val) mt76_rmw(dev, offset, 0, val) #define mt76_clear(dev, offset, val) mt76_rmw(dev, offset, val, 0)