From patchwork Sun Jan 1 11:53:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 638422 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 CB8F7C4332F for ; Sun, 1 Jan 2023 11:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbjAALxh (ORCPT ); Sun, 1 Jan 2023 06:53:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjAALxg (ORCPT ); Sun, 1 Jan 2023 06:53:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D30FC26D6 for ; Sun, 1 Jan 2023 03:53:35 -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 6C7FE60DBB for ; Sun, 1 Jan 2023 11:53:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77421C433EF; Sun, 1 Jan 2023 11:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672574014; bh=zB0gr5obkcDIs83XBUPkeP+DX9P5EjI9FfjbGTDI/xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+DDTNWnhSYsx8UlAm4nBvvqEWXrfkPNycDQrch72z1N8hwAgOVegp6C8ePacPVKZ ZsJesGz8TBOOGD0K2E8aqWCs77SRHNkjborIiSDaYcTr3Z/gXARXLz6rrXE+24sjh5 3a6tCTkBZQkVLWTo+XYtgFddkn+qGcIOUono5OIBj9qHJ9vmOgamBrY+1neLvQnnNJ bPLU75vtYIce+GZcy6CS1SoRDe+mergY7guu2CHFv0G10FfghSmmVro5RJw/+WBHrR HflDIq3GY0lJ+AA34uPthUS7mMBFOJcMNH7tAP+4It8b6ZyL34AcoOLuOnDLet3X5E unRc7HBSVHSqA== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH 1/6] wifi: mt76: mt7915: avoid mcu_restart function pointer Date: Sun, 1 Jan 2023 12:53:18 +0100 Message-Id: <671a32a6550323555c1807e1ac83a7bff15e500e.1672573894.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Run mt76_connac_mcu_restart routine directly and avoid mcu_restart function pointer whenever it is possible. Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index e69ef2828925..55517e0f8c84 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -2104,7 +2104,7 @@ static int mt7915_load_firmware(struct mt7915_dev *dev) /* make sure fw is download state */ if (mt7915_firmware_state(dev, false)) { /* restart firmware once */ - __mt76_mcu_restart(&dev->mt76); + mt76_connac_mcu_restart(&dev->mt76); ret = mt7915_firmware_state(dev, false); if (ret) { dev_err(dev->mt76.dev, @@ -2336,7 +2336,6 @@ int mt7915_mcu_init(struct mt7915_dev *dev) .headroom = sizeof(struct mt76_connac2_mcu_txd), .mcu_skb_send_msg = mt7915_mcu_send_message, .mcu_parse_response = mt7915_mcu_parse_response, - .mcu_restart = mt76_connac_mcu_restart, }; dev->mt76.mcu_ops = &mt7915_mcu_ops; @@ -2346,7 +2345,7 @@ int mt7915_mcu_init(struct mt7915_dev *dev) void mt7915_mcu_exit(struct mt7915_dev *dev) { - __mt76_mcu_restart(&dev->mt76); + mt76_connac_mcu_restart(&dev->mt76); if (mt7915_firmware_state(dev, false)) { dev_err(dev->mt76.dev, "Failed to exit mcu\n"); goto out; From patchwork Sun Jan 1 11:53:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 638718 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 7D553C4332F for ; Sun, 1 Jan 2023 11:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbjAALxo (ORCPT ); Sun, 1 Jan 2023 06:53:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbjAALxn (ORCPT ); Sun, 1 Jan 2023 06:53:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A2226E6 for ; Sun, 1 Jan 2023 03:53:41 -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 21248B8091A for ; Sun, 1 Jan 2023 11:53:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 670E2C433EF; Sun, 1 Jan 2023 11:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672574018; bh=zGhv7VUBExUx7mSrY0FyCkLxLdsxJEL9M/HJ8SYZn6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJqBwH1ovoak0ZQIkod5288tMTOttg7qE5Mm0z5cJ1+zE/qulNcU6UV4qD7AeagKp oIwc8chjv3hTII3OTnI7NLZTlTn/g0TtIvzw83EaHEUXcisEuv6Y2Xy3Pz+PmHiXC3 D3KOQzgrCbx/war5GukoLFY+uWxlizIAKIFMA5SbhMVwQw4sFveI+B88FyZtzkR7OD 1qh0wl0ZeRurfSp71LoMIbbMygdHAJsem+6GNYnPM7UEqtAnDPHZgPgXCbTAtptoHz 5krfAEgSXxnqTDMY2PQ7Eje8G0cJeCSI1GBXpoGRvzgvbu4MOC+tg3Hdbfxad0D9D3 1fplFj8pjhwog== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH 2/6] wifi: mt76: mt7603: avoid mcu_restart function pointer Date: Sun, 1 Jan 2023 12:53:19 +0100 Message-Id: <2eba74f7d407cef21bc773fd4192702df468d9cd.1672573894.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Run mt7603_mcu_restart routine directly and avoid mcu_restart function pointer whenever it is possible. Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7603/mcu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c index 7884b952b720..301668c3cc92 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mcu.c @@ -221,7 +221,6 @@ int mt7603_mcu_init(struct mt7603_dev *dev) .headroom = sizeof(struct mt7603_mcu_txd), .mcu_skb_send_msg = mt7603_mcu_skb_send_msg, .mcu_parse_response = mt7603_mcu_parse_response, - .mcu_restart = mt7603_mcu_restart, }; dev->mt76.mcu_ops = &mt7603_mcu_ops; @@ -230,7 +229,7 @@ int mt7603_mcu_init(struct mt7603_dev *dev) void mt7603_mcu_exit(struct mt7603_dev *dev) { - __mt76_mcu_restart(&dev->mt76); + mt7603_mcu_restart(&dev->mt76); skb_queue_purge(&dev->mt76.mcu.res_q); } From patchwork Sun Jan 1 11:53:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 638421 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 6FD13C4708E for ; Sun, 1 Jan 2023 11:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230266AbjAALxp (ORCPT ); Sun, 1 Jan 2023 06:53:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjAALxo (ORCPT ); Sun, 1 Jan 2023 06:53:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 904903897 for ; Sun, 1 Jan 2023 03:53:43 -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 2898F60D2D for ; Sun, 1 Jan 2023 11:53:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3564AC433F1; Sun, 1 Jan 2023 11:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672574022; bh=ietCfeQjsD5D6tgi4L352UJjOh3jnY+LqpW/RypdV8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2jsiP5pYI0PtP1GIG6mh5jWglJWj9fTjQSczOeUN17Lz/RZYZPS5OhD6X4elfqca nK827VWfRQXeu7uznShyvwUZYMi6AqSeq84s+YijjYM+3nPq95PDs/7NrdG4XONgrD FWF0qYvhVGQrcl6pETJogzUEFJOGU0e+QfwUEn6jTHJ5j+w3bNUOwyyg/xP6e0v5/3 c77e8Z28VaGYaFPeBHZ5DWIVRnFJ/SisXw6DwN6BSK5MWTyWCNEEhpa+zySMThnpMt zpYNqmGJ985xRQN3zocQIjgmVoitRDRqC6NwuMT7oX5t/MdFauAAS0GMkOejU13k5z 9W2zFKns8MDBg== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH 3/6] wifi: mt76: mt7615: avoid mcu_restart function pointer Date: Sun, 1 Jan 2023 12:53:20 +0100 Message-Id: <9bbf297fe9c3b0988733fad1a5fda77811b05318.1672573894.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Run mt7615_mcu_restart routine directly and avoid mcu_restart function pointer whenever it is possible. Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 3 +-- drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c | 1 - drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 83f30305414d..eea398c79a98 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1692,7 +1692,6 @@ int mt7615_mcu_init(struct mt7615_dev *dev) .headroom = sizeof(struct mt7615_mcu_txd), .mcu_skb_send_msg = mt7615_mcu_send_message, .mcu_parse_response = mt7615_mcu_parse_response, - .mcu_restart = mt7615_mcu_restart, }; int ret; @@ -1732,7 +1731,7 @@ EXPORT_SYMBOL_GPL(mt7615_mcu_init); void mt7615_mcu_exit(struct mt7615_dev *dev) { - __mt76_mcu_restart(&dev->mt76); + mt7615_mcu_restart(&dev->mt76); mt7615_mcu_set_fw_ctrl(dev); skb_queue_purge(&dev->mt76.mcu.res_q); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c index dc9a2f0b45a5..b0094205ba95 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c @@ -137,7 +137,6 @@ int mt7663s_mcu_init(struct mt7615_dev *dev) .tailroom = MT_USB_TAIL_SIZE, .mcu_skb_send_msg = mt7663s_mcu_send_message, .mcu_parse_response = mt7615_mcu_parse_response, - .mcu_restart = mt7615_mcu_restart, .mcu_rr = mt76_connac_mcu_reg_rr, .mcu_wr = mt76_connac_mcu_reg_wr, }; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c index 98bf2f6ae936..a8b1a0f8b2d7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c @@ -69,7 +69,6 @@ int mt7663u_mcu_init(struct mt7615_dev *dev) .tailroom = MT_USB_TAIL_SIZE, .mcu_skb_send_msg = mt7663u_mcu_send_message, .mcu_parse_response = mt7615_mcu_parse_response, - .mcu_restart = mt7615_mcu_restart, }; int ret; From patchwork Sun Jan 1 11:53:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 638717 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 03C88C4332F for ; Sun, 1 Jan 2023 11:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230282AbjAALxu (ORCPT ); Sun, 1 Jan 2023 06:53:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjAALxs (ORCPT ); Sun, 1 Jan 2023 06:53:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D61426DF for ; Sun, 1 Jan 2023 03:53:47 -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 EF2D460DBB for ; Sun, 1 Jan 2023 11:53:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F723C433F1; Sun, 1 Jan 2023 11:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672574026; bh=VlicA5pRm9FPXztodxfd7lmvBZraQWf45kNTGX/lDDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2sdadoQJozJi82tcE400vnPTl0depVumUOD3el0AqFP/JEL9nCUz/Mmi8P9sMIex Lf7Hxawx60wqW3Skzd+7ys4ZJcwzQYLlyX7ujxYdLoUGOkt/1H7cXtooA55A+FLovz i1HtiQdzKkVs7l0q5Dd/Y7xZ1852Icx6fg3fM4fLFEJyngpVLoRxbe7a7bFdzTZmbQ Q210YDSHLhbVIjw0YBCkXy65EkJJXuwegW+uB2d7Nt23ZkmiRiI7T/nJOCSl5pgaFV JfVDb8yFv8LUXRA0cQQu/6rb8UXWchVY0F8jKkXjErLzUeIiQyTYQidvS43ikRynCA r8cBFvzIeDrjg== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH 4/6] wifi: mt76: mt7921: avoid mcu_restart function pointer Date: Sun, 1 Jan 2023 12:53:21 +0100 Message-Id: <286d79841c18bf0048e2a8e8e4896f6f053a8fe6.1672573894.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Avoid mcu_restart function pointer whenever it is possible. Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c | 1 - drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c index 86340d3205c5..0e7ea35efa8d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c @@ -44,7 +44,6 @@ int mt7921e_mcu_init(struct mt7921_dev *dev) .headroom = sizeof(struct mt76_connac2_mcu_txd), .mcu_skb_send_msg = mt7921_mcu_send_message, .mcu_parse_response = mt7921_mcu_parse_response, - .mcu_restart = mt76_connac_mcu_restart, }; int err; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c index 5321d20dcdcb..a277d9ef2db4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c @@ -133,7 +133,6 @@ static int mt7921u_mcu_init(struct mt7921_dev *dev) .tailroom = MT_USB_TAIL_SIZE, .mcu_skb_send_msg = mt7921u_mcu_send_message, .mcu_parse_response = mt7921_mcu_parse_response, - .mcu_restart = mt76_connac_mcu_restart, }; int ret; From patchwork Sun Jan 1 11:53:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 638420 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 66C6DC4332F for ; Sun, 1 Jan 2023 11:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230292AbjAALxy (ORCPT ); Sun, 1 Jan 2023 06:53:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjAALxx (ORCPT ); Sun, 1 Jan 2023 06:53:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99C1426D6 for ; Sun, 1 Jan 2023 03:53:52 -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 5507AB8091A for ; Sun, 1 Jan 2023 11:53:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6EEBC433F1; Sun, 1 Jan 2023 11:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672574030; bh=LPvAURvDIj8vO8luALUitQUOEHfTgvOhNjd8S26jXf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKCZLo8xiK5NHVEWO3UM6UjRuikDjP4fhtGsarod80Gj75aCxYfMZaroI/fmMuBHz kd/gdUMcdSfVzC0NzlUL6W/hs3LyCay962k9PHRaUL2ntxeHBUqCMKyrzBlpT66yej 915EnwWs8qPhkJzc8QzIIpYUZwFZZ1gXx/t+LDntbS3UR9gkqe2v+OVfqBIsx3qzAB Xuc5kIroVDZdIVOwxAJYS5d4KqLP7qLuk8OPl9jOV7445eTLHXr2zqenlFVhHT62N4 JMXH1Izq+Nkjhlu4I85ZMRxk8oRz9jAIodkUcRh1ydKSVOXriVfE2gYI4Y22hUx4Zc klR/KseZKsVnA== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH 5/6] wifi: mt76: mt7996: avoid mcu_restart function pointer Date: Sun, 1 Jan 2023 12:53:22 +0100 Message-Id: X-Mailer: git-send-email 2.38.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 af6d80655471..158f8387547f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -2241,6 +2241,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_CREL), &req, + sizeof(req), false); +} + static int mt7996_load_firmware(struct mt7996_dev *dev) { int ret; @@ -2248,7 +2268,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, @@ -2377,33 +2397,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_CREL), &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; @@ -2451,7 +2450,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 Sun Jan 1 11:53:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 638716 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 69443C4332F for ; Sun, 1 Jan 2023 11:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbjAALyA (ORCPT ); Sun, 1 Jan 2023 06:54:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbjAALx7 (ORCPT ); Sun, 1 Jan 2023 06:53:59 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CEF96156 for ; Sun, 1 Jan 2023 03:53:57 -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 sin.source.kernel.org (Postfix) with ESMTPS id 9F6A9CE0954 for ; Sun, 1 Jan 2023 11:53:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65CE9C433F1; Sun, 1 Jan 2023 11:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672574033; bh=AEbuJ9nDqKtvdaIge4xzygqXgXaP+eiH1QtFrkLMrEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CF4dw3b+Fq7uAgJPrhEKwcJWXpI1lf1dakp0oA9a1cCshU9oeIDjPYg4S3r7UWj6c IxLGVtGsW8Ic2+Nax6cd4i7C6Xlve+fEekRwPLTfqUirzaA+hUF1hZ8opHoyPyPbo1 ++XV2wjVaZ1NUZmOpSlvLvU9A9mEZe0hfE0VQJ6/ByQI+rmNcJde2Xiiq6CImdrIsj ogF/Sy/v3k7bXKaIIrWdowvWNq6xBaRjDHEnlXO5PSpd9FFcv27Nhuc7Rg1jgV3bHK OEsPxf9/heHXMvUToGPWkS0SJ/HwSfXl8XQgD5Irpn2iHnpaoAUu51z2CmvodS3jMA 1z0Fdo7SeCyuQ== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH 6/6] wifi: mt76: remove __mt76_mcu_restart macro Date: Sun, 1 Jan 2023 12:53:23 +0100 Message-Id: <7764276e47d5e30ec9fbac619653abbd888a3e4a.1672573894.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.38.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 f351a37c47f7..4f808b676954 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)