From patchwork Sat Apr 2 17:14:09 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: 683821 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 p32HEHBE027594 for ; Sat, 2 Apr 2011 17:14:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756087Ab1DBROP (ORCPT ); Sat, 2 Apr 2011 13:14:15 -0400 Received: from mail-ew0-f46.google.com ([209.85.215.46]:51571 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756012Ab1DBROP (ORCPT ); Sat, 2 Apr 2011 13:14:15 -0400 Received: by ewy4 with SMTP id 4so1337839ewy.19 for ; Sat, 02 Apr 2011 10:14:14 -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=MQ+qH4nyJIBDPQU4c8yWdLB7gM9Qzbq/549nCR7Kj9I=; b=QWWcCrfbXRNJHo3rEGekylj4ub6Ib5KcZ+NvOz5lZ7QAeNzTjpe3g6QFnDmb2yVXfY BadtOMXRoRq6X5qZkRlPT5QyyHnJo/moiIERaS8Jv7uUuV44AcnyXVXX+rgiR+N0on0q m+pg6t4U668iV5Yvm0RzsajtaG4/U1kG5DEME= 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=r0YyEI3mI8WUc9q4rguDWUJQFujn8c1rJ0I5HdBH+ciPlXUsNZsEvOCIeF/daEvWXL WPjbZH1eWqAmaZH7SeW2OeJpAdV/qMwuyU64oxaz8+uowMBMkWx1FHljaN9/K43yAg7L 5D9UMJ0OYIvTZ1ZejR2Y/WUm5CqCaC4bsCzL8= Received: by 10.213.114.7 with SMTP id c7mr910039ebq.27.1301764454206; Sat, 02 Apr 2011 10:14:14 -0700 (PDT) Received: from localhost.localdomain (g121037.upc-g.chello.nl [80.57.121.37]) by mx.google.com with ESMTPS id r48sm2163301eei.16.2011.04.02.10.14.12 (version=SSLv3 cipher=OTHER); Sat, 02 Apr 2011 10:14:13 -0700 (PDT) From: Ivo van Doorn To: "John W. Linville" Subject: [PATCH 05/13 v2] rt2x00: Restructure bw_comp calculation Date: Sat, 2 Apr 2011 19:14:09 +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> <201103281331.00838.IvDoorn@gmail.com> <201103281331.31575.IvDoorn@gmail.com> In-Reply-To: <201103281331.31575.IvDoorn@gmail.com> MIME-Version: 1.0 Message-Id: <201104021914.10117.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]); Sat, 02 Apr 2011 17:14:17 +0000 (UTC) From: Helmut Schaa Move the HT40 check inside the calculation function to make it easier for a later cleanup. Signed-off-by: Helmut Schaa Signed-off-by: Ivo van Doorn --- v2: Fix subject --- drivers/net/wireless/rt2x00/rt2800lib.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) 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)) { /*