Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp414256pxu; Thu, 3 Dec 2020 03:36:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpEkOCNNETJPXN/TMHVvq1Bh6wwxnqvXMRMiU9/4Ik7M98nsxXqxwh3FxuiBzsYsr2pdJa X-Received: by 2002:a17:907:20a6:: with SMTP id pw6mr2194185ejb.73.1606995370206; Thu, 03 Dec 2020 03:36:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606995370; cv=none; d=google.com; s=arc-20160816; b=rfluiBxEyOmlqeZ/cp/U6e0G2XQD4f5UutN1AvjOd1q2G8JS/6XmI6VVhksj7LReIC qL6F1DNRPJMgQCwW1H+SVO1XpW6lOiRIeSTfA2UcyZA0mRKx9/jCvS/f4yiMMtocqo99 Nt/2mi2yeFJAOMPh8p+jNqUXza87U782mZZHo2bQIRDibKdCVvrxffK1+Z/uCHEK+7iU xirWfhxpCQN/PJovFdrfoC4N7menQ8sGXX0KOl5gEmfo5gKm5PLzDaNfvW0p4nvkDeIk h+S0oI0S2nsORLjFLhRkxHOXKndPKjV4ZiJWmSuNQPnzyFIXt9+hHY++cNNhfbAbdQf3 Bntw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=sJ4NmjfTlQ7u4miahn5R1cbU+T9nrlarbnAmmneC+3Y=; b=uUoZB+hyf9ID8i07mINE4IJwQhEw2NszJp9/ioJxN6CC5VdQ5uTLJWWnVzzHTG9P4d OUyX2fIVJkV2ptruJzjrTRntZwqt/SLFnlSdC41v1Rz6cJ6N9Qc4sdOkwdZGlYJvhcXk 9kaPTaYNu1b4oTzHj2Dwgnf3+V4Tj57g1HNnJkFtMGYS+OfezBdm9txZWuhrmkiD8bSJ FtX6NRXUUxt08acobCMbvFkSPVRc+kfM/e7QhLg6npsDSFBDKeVt5hyxNtIYVLvcRLSt 5cxDnbMXjgTNS7i59ffl9mksx5nlyOTupd2wVpRsch7aPifUOdpAavCNIzMAoIoOP+T+ xKNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si761601edf.2.2020.12.03.03.35.46; Thu, 03 Dec 2020 03:36:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729162AbgLCLdF (ORCPT + 99 others); Thu, 3 Dec 2020 06:33:05 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:54762 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726061AbgLCLdF (ORCPT ); Thu, 3 Dec 2020 06:33:05 -0500 X-UUID: f504ff3665d7482b807e00ce5fd13013-20201203 X-UUID: f504ff3665d7482b807e00ce5fd13013-20201203 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1947520699; Thu, 03 Dec 2020 19:32:17 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Dec 2020 19:32:15 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 3 Dec 2020 19:32:15 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , linux-mediatek , Shayne Chen Subject: [PATCH] mt76: mt7915: fix "defined but not used" compiler warning Date: Thu, 3 Dec 2020 19:32:10 +0800 Message-ID: <20201203113210.16354-1-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If CONFIG_NL80211_TESTMODE is not set, the following compiler warning appears: warning: 'mt7915_mac_tx_rate_val' defined but not used [-Wunused-function] Since mt7915_mac_tx_rate_val() is only used by mt7915_mac_write_txwi_tm(), merge them to get rid of this warning. Fixes: 3ac860a ("mt76: mt7915: implement testmode tx support") Signed-off-by: Shayne Chen --- .../net/wireless/mediatek/mt76/mt7915/mac.c | 68 ++++++++----------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index d93d5ba..21005be 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -600,51 +600,16 @@ void mt7915_mac_fill_rx_vector(struct mt7915_dev *dev, struct sk_buff *skb) } #endif -static u16 -mt7915_mac_tx_rate_val(struct mt76_phy *mphy, u8 mode, u8 rate_idx, - u8 nss, u8 stbc, u8 *bw) -{ - u16 rateval = 0; - - switch (mphy->chandef.width) { - case NL80211_CHAN_WIDTH_40: - *bw = 1; - break; - case NL80211_CHAN_WIDTH_80: - *bw = 2; - break; - case NL80211_CHAN_WIDTH_80P80: - case NL80211_CHAN_WIDTH_160: - *bw = 3; - break; - default: - *bw = 0; - break; - } - - if (mode == MT_PHY_TYPE_HT || mode == MT_PHY_TYPE_HT_GF) - nss = 1 + (rate_idx >> 3); - - if (stbc && nss == 1) { - nss++; - rateval |= MT_TX_RATE_STBC; - } - - rateval |= FIELD_PREP(MT_TX_RATE_IDX, rate_idx) | - FIELD_PREP(MT_TX_RATE_MODE, mode) | - FIELD_PREP(MT_TX_RATE_NSS, nss - 1); - - return rateval; -} - static void mt7915_mac_write_txwi_tm(struct mt7915_dev *dev, struct mt76_phy *mphy, __le32 *txwi, struct sk_buff *skb) { #ifdef CONFIG_NL80211_TESTMODE struct mt76_testmode_data *td = &dev->mt76.test; + u8 rate_idx = td->tx_rate_idx; + u8 nss = td->tx_rate_nss; u8 bw, mode; - u16 rateval; + u16 rateval = 0; u32 val; if (skb != dev->mt76.test.tx_skb) @@ -655,6 +620,7 @@ mt7915_mac_write_txwi_tm(struct mt7915_dev *dev, struct mt76_phy *mphy, mode = MT_PHY_TYPE_CCK; break; case MT76_TM_TX_MODE_HT: + nss = 1 + (rate_idx >> 3); mode = MT_PHY_TYPE_HT; break; case MT76_TM_TX_MODE_VHT: @@ -678,8 +644,30 @@ mt7915_mac_write_txwi_tm(struct mt7915_dev *dev, struct mt76_phy *mphy, break; } - rateval = mt7915_mac_tx_rate_val(mphy, mode, td->tx_rate_idx, - td->tx_rate_nss, td->tx_rate_stbc, &bw); + switch (mphy->chandef.width) { + case NL80211_CHAN_WIDTH_40: + bw = 1; + break; + case NL80211_CHAN_WIDTH_80: + bw = 2; + break; + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + bw = 3; + break; + default: + bw = 0; + break; + } + + if (td->tx_rate_stbc && nss == 1) { + nss++; + rateval |= MT_TX_RATE_STBC; + } + + rateval |= FIELD_PREP(MT_TX_RATE_IDX, rate_idx) | + FIELD_PREP(MT_TX_RATE_MODE, mode) | + FIELD_PREP(MT_TX_RATE_NSS, nss - 1); txwi[2] |= cpu_to_le32(MT_TXD2_FIX_RATE); -- 2.17.1