ath9k: Cleanup ath_rc_setvalid_rates

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 29 10:59:31 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c05ea151770f6508e611b789f84c8bf57fa267cd
Commit:     c05ea151770f6508e611b789f84c8bf57fa267cd
Parent:     ea2771f642315847cdc0d392602fa3039af41743
Author:     Sujith Manoharan <c_manoha at qca.qualcomm.com>
AuthorDate: Fri Aug 10 16:46:11 2012 +0530
Committer:  John W. Linville <linville at tuxdriver.com>
CommitDate: Fri Aug 10 15:27:08 2012 -0400

    ath9k: Cleanup ath_rc_setvalid_rates
    
    Signed-off-by: Sujith Manoharan <c_manoha at qca.qualcomm.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>
---
 drivers/net/wireless/ath/ath9k/rc.c |   53 +++++++++++++++-------------------
 1 files changed, 23 insertions(+), 30 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);
 		}
 	}
 



More information about the linux-mtd-cvs mailing list