From patchwork Sat Apr 3 12:35:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 415251 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.0 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 764F8C433B4 for ; Sat, 3 Apr 2021 12:35:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4610F61158 for ; Sat, 3 Apr 2021 12:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231800AbhDCMf1 (ORCPT ); Sat, 3 Apr 2021 08:35:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:60676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhDCMf1 (ORCPT ); Sat, 3 Apr 2021 08:35:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5A386121F; Sat, 3 Apr 2021 12:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617453324; bh=uDQ6q4qUKnpZVF4UWarGNBvgB2f/VXPNnVcQWsK2AiE=; h=From:To:Cc:Subject:Date:From; b=KBCOM7Lciaq6QQu4J8SdzuLGPvOI0pqsKhZAUpxPF31/a2WW6rX9cMyC8XY/WI6a6 zBANR27dlQpWQZ3G8CWnwb/tIJbpztLU5cH1e8SlzqB/JTgwKy2J06nxf6+kY5ric5 RZNAqPPpy4dX+ikVh55y5k6ny8bWEQ4GNquppd5vep8BPMRTPdoOO2uBsDaWaqyMwV WXB7Cp+3QKJlU1QWsgcXAOzuUBTIHcfmuMuFYkEUZQ+PKNc6YCIC9+ByArbTwK6Qu4 PkBIQs8mYk73Xu0V13RuLl0YPYrFHA+xBNZGWc0+98u6wI6nkLJlmw775HH4mbvzVT yYJxFcMedXLAw== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, sean.wang@mediatek.com, leon.yen@mediatek.com Subject: [PATCH] mt76: mt7921: rework mt7921_mcu_debug_msg_event routine Date: Sat, 3 Apr 2021 14:35:12 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Rework mt7921_mcu_debug_msg_event routing removing unnecessary assignments and relying on wiphy_info Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index b0ece9eae858..e44ce9bdfa9d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -485,29 +485,27 @@ mt7921_mcu_bss_event(struct mt7921_dev *dev, struct sk_buff *skb) static void mt7921_mcu_debug_msg_event(struct mt7921_dev *dev, struct sk_buff *skb) { - struct mt7921_mcu_rxd *rxd = (struct mt7921_mcu_rxd *)skb->data; - struct debug_msg { + struct mt7921_debug_msg { __le16 id; u8 type; u8 flag; __le32 value; __le16 len; u8 content[512]; - } __packed * debug_msg; - u16 cur_len; - int i; - - skb_pull(skb, sizeof(*rxd)); - debug_msg = (struct debug_msg *)skb->data; + } __packed * msg; - cur_len = min_t(u16, le16_to_cpu(debug_msg->len), 512); + skb_pull(skb, sizeof(struct mt7921_mcu_rxd)); + msg = (struct mt7921_debug_msg *)skb->data; - if (debug_msg->type == 0x3) { - for (i = 0 ; i < cur_len; i++) - if (!debug_msg->content[i]) - debug_msg->content[i] = ' '; + if (msg->type == 3) { /* fw log */ + u16 len = min_t(u16, le16_to_cpu(msg->len), 512); + int i; - dev_dbg(dev->mt76.dev, "%s", debug_msg->content); + for (i = 0 ; i < len; i++) { + if (!msg->content[i]) + msg->content[i] = ' '; + } + wiphy_info(mt76_hw(dev)->wiphy, "%*s", len, msg->content); } }