From patchwork Tue Aug 7 01:13:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 1282251 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B56DF3FC23 for ; Tue, 7 Aug 2012 01:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757049Ab2HGBO7 (ORCPT ); Mon, 6 Aug 2012 21:14:59 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:7787 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757001Ab2HGBO7 (ORCPT ); Mon, 6 Aug 2012 21:14:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1344302100; x=1375838100; h=from:mime-version:content-transfer-encoding:message-id: date:to:cc:subject; bh=AWI0/5fH8yjOEqXMorCyQCd9vLl2Af7SVDd7g/blyrY=; b=gQUQ+EMMecNdjj4kM5gytcRNVXQPA6LEiuLkLJxacyvMIJi0BkYzchSL Ut2y5W4gDuUOMw4BFeFAYkUUFgzNXKbixD7U2ZallLSrGeWgiSlhM7qe6 /HZmFghxyfSiUcXu5cTdnf1LY4OlyLJ5tfqlftSpMU68Z4j7NbJB2iluI 4=; X-IronPort-AV: E=McAfee;i="5400,1158,6795"; a="221455160" Received: from ironmsg04-l.qualcomm.com ([172.30.48.19]) by wolverine01.qualcomm.com with ESMTP; 06 Aug 2012 18:14:59 -0700 X-IronPort-AV: E=Sophos;i="4.77,723,1336374000"; d="scan'208";a="276182642" Received: from nasanexhc09.na.qualcomm.com ([172.30.39.8]) by Ironmsg04-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 06 Aug 2012 18:15:00 -0700 Received: from nasanexhc05.na.qualcomm.com (172.30.48.2) by nasanexhc09.na.qualcomm.com (172.30.39.8) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 6 Aug 2012 18:14:58 -0700 Received: from sarge (172.30.48.1) by qcmail1.qualcomm.com (172.30.48.2) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 6 Aug 2012 18:14:57 -0700 From: Sujith Manoharan MIME-Version: 1.0 Message-ID: <20512.27585.897541.55743@gargle.gargle.HOWL> Date: Tue, 7 Aug 2012 06:43:37 +0530 To: X-Mailer: VM 8.2.0b under 24.1.1 (x86_64-unknown-linux-gnu) CC: Subject: [RFC 03/14] ath9k: Cleanup ath_rc_setvalid_rates X-Originating-IP: [172.30.48.1] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath9k/rc.c | 49 ++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 49c71da..a34f678 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c @@ -516,39 +516,32 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv) { const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; struct ath_rateset *rateset = &ath_rc_priv->neg_rates; - u32 capflag = ath_rc_priv->ht_cap; - u8 i, j, hi = 0; + u32 phy, capflag = ath_rc_priv->ht_cap; + u16 rate_flags; + u8 i, j, hi = 0, rate, dot11rate, valid_rate_count; for (i = 0; i < rateset->rs_nrates; i++) { for (j = 0; j < rate_table->rate_cnt; j++) { - u32 phy = rate_table->info[j].phy; - u16 rate_flags = rate_table->info[j].rate_flags; - u8 rate = rateset->rs_rates[i]; - u8 dot11rate = rate_table->info[j].dot11rate; - - /* We allow a rate only if its valid and the - * capflag matches one of the validity - * (VALID/VALID_20/VALID_40) flags */ - - if ((rate == dot11rate) && - (rate_flags & WLAN_RC_CAP_MODE(capflag)) == - WLAN_RC_CAP_MODE(capflag) && - (rate_flags & WLAN_RC_CAP_STREAM(capflag)) && - !WLAN_RC_PHY_HT(phy)) { - u8 valid_rate_count = 0; - - if (!ath_rc_valid_phyrate(phy, capflag, 0)) - continue; + phy = rate_table->info[j].phy; + rate_flags = rate_table->info[j].rate_flags; + rate = rateset->rs_rates[i]; + dot11rate = rate_table->info[j].dot11rate; + + if (rate != dot11rate + || ((rate_flags & WLAN_RC_CAP_MODE(capflag)) != + WLAN_RC_CAP_MODE(capflag)) + || !(rate_flags & WLAN_RC_CAP_STREAM(capflag)) + || WLAN_RC_PHY_HT(phy)) + continue; - valid_rate_count = - ath_rc_priv->valid_phy_ratecnt[phy]; + if (!ath_rc_valid_phyrate(phy, capflag, 0)) + continue; - ath_rc_priv->valid_phy_rateidx[phy] - [valid_rate_count] = j; - ath_rc_priv->valid_phy_ratecnt[phy] += 1; - ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1); - hi = max(hi, j); - } + valid_rate_count = ath_rc_priv->valid_phy_ratecnt[phy]; + ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = j; + ath_rc_priv->valid_phy_ratecnt[phy] += 1; + ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1); + hi = max(hi, j); } }