From patchwork Mon Mar 28 11:31:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivo van Doorn X-Patchwork-Id: 668201 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2SBawQd010580 for ; Mon, 28 Mar 2011 11:36:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753202Ab1C1Lg4 (ORCPT ); Mon, 28 Mar 2011 07:36:56 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:63099 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753169Ab1C1Lg4 (ORCPT ); Mon, 28 Mar 2011 07:36:56 -0400 Received: by wya21 with SMTP id 21so2744896wya.19 for ; Mon, 28 Mar 2011 04:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id; bh=FouwEU6Zpl5yYvDexod9LPMnE53bNpc/DmWX9+EYpAU=; b=VwuQ68H94fHwNKplr5ljqO+WMKUzGYZxAu/37MDSd4QLigb1jhlmIuUIhOMjXrCuJ/ 1bUfKzQ8YrRFQTfe3u2Kud6VjzrNj2ahsYnb4h3iCY3ELrUhMff8VEOnKMtAYpMIUxbe 3f9IQZPTLQ0SOU6J5xSQEyubyQGmDd7wtrP7o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=nZFLjP2LFKShUnBbNn0WtaHHGtNlK3nkB7zYOhSt3HjNLyqIL12XFKEPfG8gTV4uZP hADmYkgsb04eqr5+9TKSh8pA0ng5vskQxWWhh74JFO09lz2f2xd7ByxfkJ9I/I/X99UG c1OciaJeesc8ugWuGMwT3r2UPpClvT44meKTM= Received: by 10.227.0.88 with SMTP id 24mr3797194wba.123.1301312214993; Mon, 28 Mar 2011 04:36:54 -0700 (PDT) Received: from localhost.localdomain (g121037.upc-g.chello.nl [80.57.121.37]) by mx.google.com with ESMTPS id h11sm1945140wbc.9.2011.03.28.04.36.53 (version=SSLv3 cipher=OTHER); Mon, 28 Mar 2011 04:36:54 -0700 (PDT) From: Ivo van Doorn To: "John W. Linville" Subject: [PATCH 05/13] rt2x00: Restructure bw_comp calculationATCHDOG flag Date: Mon, 28 Mar 2011 13:31:30 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.x86_64; KDE/4.4.5; x86_64; ; ) Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com References: <201103281329.45470.IvDoorn@gmail.com> <201103281330.36856.IvDoorn@gmail.com> <201103281331.00838.IvDoorn@gmail.com> In-Reply-To: <201103281331.00838.IvDoorn@gmail.com> MIME-Version: 1.0 Message-Id: <201103281331.31575.IvDoorn@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 28 Mar 2011 11:36:58 +0000 (UTC) diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 2ee6ceb..2f8af7a 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -1819,11 +1819,15 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev, u16 eeprom; u8 comp_en; u8 comp_type; - int comp_value; + int comp_value = 0; rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_DELTA, &eeprom); - if (eeprom == 0xffff) + /* + * HT40 compensation not required. + */ + if (eeprom == 0xffff || + !test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) return 0; if (band == IEEE80211_BAND_2GHZ) { @@ -1865,13 +1869,12 @@ static u8 rt2800_compesate_txpower(struct rt2x00_dev *rt2x00dev, u8 eirp_txpower; u8 eirp_txpower_criterion; u8 reg_limit; - int bw_comp = 0; + int bw_comp; if (!((band == IEEE80211_BAND_5GHZ) && is_rate_b)) return txpower; - if (test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) - bw_comp = rt2800_get_txpower_bw_comp(rt2x00dev, band); + bw_comp = rt2800_get_txpower_bw_comp(rt2x00dev, band); if (test_bit(CONFIG_SUPPORT_POWER_LIMIT, &rt2x00dev->flags)) { /*