From patchwork Sat Apr 30 15:15:13 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: 743762 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p3UFItlA009154 for ; Sat, 30 Apr 2011 15:18:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757372Ab1D3PSx (ORCPT ); Sat, 30 Apr 2011 11:18:53 -0400 Received: from mail-ew0-f46.google.com ([209.85.215.46]:43423 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753121Ab1D3PSu (ORCPT ); Sat, 30 Apr 2011 11:18:50 -0400 Received: by mail-ew0-f46.google.com with SMTP id 4so1390988ewy.19 for ; Sat, 30 Apr 2011 08:18:49 -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=AYv9K7fv65uz9KqgqBHp0eUQYQf538m3RY2VVGcte3k=; b=fet3Y0+3/NBvCcYcWf3E9yWcLnGmcNEQvRYGK93DzscDyGgQGWiy8/KeoQrcl5GPlG Oq1uAqUE145SZdJL5L6cBi+5P9eaFOmVPCzLgK1uUzQFE/y8o9u6sxKu49l8mDfFsvSz nZeVK+hAdM+/zmKvzQHVq35rcbWZ/IMn6WAsQ= 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=Fnu3s66urC8R1bMXlJ5BKU3rB2n31bMTu3PUWy3RlOvtFS+jBXA499gmUR8jhfShAs jQdWyaezUHXPkfLmt/AXTF2LVlHrGAszfUyXvDCtDDEpyezUOOGBUt2CmiD05cKRkEZA WdTdOfiQ7uIPwRKtVdepMsaBHJ+zJPqUqSmIU= Received: by 10.213.12.201 with SMTP id y9mr1104828eby.16.1304176729504; Sat, 30 Apr 2011 08:18:49 -0700 (PDT) Received: from localhost.localdomain (g121037.upc-g.chello.nl [80.57.121.37]) by mx.google.com with ESMTPS id y15sm1322487eeh.20.2011.04.30.08.18.48 (version=SSLv3 cipher=OTHER); Sat, 30 Apr 2011 08:18:48 -0700 (PDT) From: Ivo van Doorn To: "John W. Linville" Subject: [PATCH 4/6] rt2x00: Streamline rt2800 eeprom initialisations. Date: Sat, 30 Apr 2011 17:15:13 +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: <201104301713.47545.IvDoorn@gmail.com> <201104301714.24685.IvDoorn@gmail.com> <201104301714.49872.IvDoorn@gmail.com> In-Reply-To: <201104301714.49872.IvDoorn@gmail.com> MIME-Version: 1.0 Message-Id: <201104301715.13753.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 (demeter2.kernel.org [140.211.167.43]); Sat, 30 Apr 2011 15:18:55 +0000 (UTC) From: Gertjan van Wingerde In rt2800lib.c the rt2800_init_eeprom function the same eeprom words were read multiple times, due to inefficient ordering of the eeprom checks. Reorder the checks so that each EEPROM word only has to be read once. Signed-off-by: Gertjan van Wingerde Signed-off-by: Ivo van Doorn --- drivers/net/wireless/rt2x00/rt2800lib.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index d79c8fd..71c16c6 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -3727,16 +3727,8 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) } /* - * Read frequency offset and RF programming sequence. + * Determine external LNA informations. */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); - rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); - - /* - * Read external LNA informations. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G)) __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags); if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G)) @@ -3749,6 +3741,12 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); /* + * Read frequency offset and RF programming sequence. + */ + rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); + rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); + + /* * Store led settings, for correct led behaviour. */ #ifdef CONFIG_RT2X00_LIB_LEDS @@ -3756,7 +3754,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &rt2x00dev->led_mcu_reg); + rt2x00dev->led_mcu_reg = eeprom; #endif /* CONFIG_RT2X00_LIB_LEDS */ /*