From patchwork Fri Mar 20 13:54:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6056871 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 173EABF910 for ; Fri, 20 Mar 2015 13:57:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39AB220528 for ; Fri, 20 Mar 2015 13:57:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5490920523 for ; Fri, 20 Mar 2015 13:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751133AbbCTN5G (ORCPT ); Fri, 20 Mar 2015 09:57:06 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:34180 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752381AbbCTN47 (ORCPT ); Fri, 20 Mar 2015 09:56:59 -0400 Received: by lbbsy1 with SMTP id sy1so75919834lbb.1 for ; Fri, 20 Mar 2015 06:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=62JD/qVakPaeM8llq6s48UUWQ/m0PWwgdtJxI7jMs44=; b=RNZzzlNdjkGAnJzvptjU/B/nn6nI9KZLlHA2Tm29pi3LMbdL6CPPEo7dyDbjiOG/g9 LmwJGAJUu/lFEpoT4hKzrwTveA+OEv2+fAbWloEDlQ+EgIYlV37xMUDCCfGZlKhGisSW nfCTW44srDrMTZJm0Uhne1LQs4nn/8XaUPQ/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=62JD/qVakPaeM8llq6s48UUWQ/m0PWwgdtJxI7jMs44=; b=exEoBV2Uu0OKJdA+HyE6vGnQxFbyyHMKYK+agYteNdxRZsdEAf1A0IH27B1DR11Ht6 WZPbRR/frTgR17ExsUZG6UeWTYF0p4iq/pBLdy8lgbByQAHlDfXPWNlysRG6r4XrmAsY hl8GNz5dF75S0D3f8r8Q1H2ERy4Dir2rA/2XxaXLXp+uqCJUcc3mKZJO4sW0E6fARFAB s+oJCsn6y0mqLSHloOhSJwxMH+QBUs7yOBdtOK0HC+pN7W+4WWIHJBwS3zqP8umt+8Y/ Rl8xbFZwtie8BXLUd7AruBpMsPtWfRuFYXpJo0KfMV7e3gKa2h3YwM98ekpCafS20UC8 ylww== X-Gm-Message-State: ALoCoQn4WwfmJmraycggau/EAjH38X00rkBtX0wzIpHFBiitJhLnSDxdxhha9x+JzsuINI77BznnMG/KDSTLb23kWBHeYesJdckp3dmb8Ia+Y39+CStLC0JM7zUm6bI+7iWrp8ojVoh5 X-Received: by 10.152.87.66 with SMTP id v2mr11996117laz.62.1426859818321; Fri, 20 Mar 2015 06:56:58 -0700 (PDT) Received: from bob.homerouter.cpe (apn-77-113-71-242.dynamic.gprs.plus.pl. [77.113.71.242]) by mx.google.com with ESMTPSA id us1sm955771lbc.1.2015.03.20.06.56.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Mar 2015 06:56:57 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH 9/9] ath10k: document ofdm/5ghz rate offset with a macro Date: Fri, 20 Mar 2015 13:54:15 +0000 Message-Id: <1426859655-11797-10-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426859655-11797-1-git-send-email-michal.kazior@tieto.com> References: <1426859655-11797-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Don't use literal values for offsets. While at it rename a function so it is more clear what it checks for. This finally takes care of the last magic 5GHz/OFDM offset. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c39a300..bdd9baa 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -60,8 +60,11 @@ static struct ieee80211_rate ath10k_rates[] = { { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M }, }; -#define ath10k_a_rates (ath10k_rates + 4) -#define ath10k_a_rates_size (ARRAY_SIZE(ath10k_rates) - 4) +#define ATH10K_MAC_FIRST_OFDM_RATE_IDX 4 + +#define ath10k_a_rates (ath10k_rates + ATH10K_MAC_FIRST_OFDM_RATE_IDX) +#define ath10k_a_rates_size (ARRAY_SIZE(ath10k_rates) - \ + ATH10K_MAC_FIRST_OFDM_RATE_IDX) #define ath10k_g_rates (ath10k_rates + 0) #define ath10k_g_rates_size (ARRAY_SIZE(ath10k_rates)) @@ -2001,10 +2004,10 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar, sta->addr, !!(arg->peer_flags & WMI_PEER_QOS)); } -static bool ath10k_mac_sta_has_11g_rates(struct ieee80211_sta *sta) +static bool ath10k_mac_sta_has_ofdm_only(struct ieee80211_sta *sta) { - /* First 4 rates in ath10k_rates are CCK (11b) rates. */ - return sta->supp_rates[IEEE80211_BAND_2GHZ] >> 4; + return sta->supp_rates[IEEE80211_BAND_2GHZ] >> + ATH10K_MAC_FIRST_OFDM_RATE_IDX; } static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, @@ -2026,7 +2029,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, phymode = MODE_11NG_HT40; else phymode = MODE_11NG_HT20; - } else if (ath10k_mac_sta_has_11g_rates(sta)) { + } else if (ath10k_mac_sta_has_ofdm_only(sta)) { phymode = MODE_11G; } else { phymode = MODE_11B;