From patchwork Mon Nov 12 21:58:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Mikityanskiy X-Patchwork-Id: 1731351 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 E40D73FCDE for ; Mon, 12 Nov 2012 21:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753975Ab2KLV7R (ORCPT ); Mon, 12 Nov 2012 16:59:17 -0500 Received: from mail-ea0-f174.google.com ([209.85.215.174]:53888 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753712Ab2KLV7N (ORCPT ); Mon, 12 Nov 2012 16:59:13 -0500 Received: by mail-ea0-f174.google.com with SMTP id o11so438703eaa.19 for ; Mon, 12 Nov 2012 13:59:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=mr5QOQpH6YJD8WrGfVPjbMrUow35aygvhBkYuy5CPew=; b=Xh4o3s2mYzZ5kZMgHTrSWoPhO/j93MQTk7RW1G2oET78zNHnynr5VDUwTc3rD1JZpM Sgvn2Orj4H0i+e57oZZSO9K64M1Oo28iBD2c0FCsoJ7EoKeoWLrmwvapoH9ywoWEXG6F eWOYRvMvp9KE0+4pvbMSkHsoxcdtK1DOPr3IkfIz8bew5lRAfLEW7I0hjvQZJ+odwSUc Uo6XtG8uEkx5nuPcuKNNs87VY8hMrUtX4LJ1yKUMd/Cu8vZte756vIKTTSmF1HR6NUI2 oJWB9+1L8jPAcKDP0LiDm5AFBoDt0dYKtVsEv2PUYEsJ/3A3Ujubc1azfSyMmfm1KcWH dHwQ== Received: by 10.14.214.133 with SMTP id c5mr67147783eep.8.1352757552694; Mon, 12 Nov 2012 13:59:12 -0800 (PST) Received: from laptop.olymp.linuxd.org (63-85-92-178.pool.ukrtel.net. [178.92.85.63]) by mx.google.com with ESMTPS id f3sm18449256eeo.13.2012.11.12.13.59.11 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Nov 2012 13:59:12 -0800 (PST) From: Maxim Mikityanskiy To: greg@kroah.com, linux-wireless@vger.kernel.org Cc: Maxim Mikityanskiy Subject: [PATCH 14/17] Removed unneeded reads from EEPROM Date: Mon, 12 Nov 2012 23:58:28 +0200 Message-Id: <1352757511-26957-15-git-send-email-maxtram95@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1352757511-26957-1-git-send-email-maxtram95@gmail.com> References: <1352757511-26957-1-git-send-email-maxtram95@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Maxim Mikityanskiy --- r8180.h | 4 ---- r8180_core.c | 36 +++++++++--------------------------- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/r8180.h b/r8180.h index db7974a..a819b01 100644 --- a/r8180.h +++ b/r8180.h @@ -365,8 +365,6 @@ typedef struct r8180_priv short digphy; short antb; short diversity; - u8 cs_treshold; - short rcr_csense; u32 key0[4]; short (*rf_set_sens)(struct net_device *dev,short sens); void (*rf_set_chan)(struct net_device *dev,short ch); @@ -623,8 +621,6 @@ typedef struct r8180_priv u8 PowerProfile; u32 CSMethod; - u8 cck_txpwr_base; - u8 ofdm_txpwr_base; u8 dma_poll_stop_mask; //u8 RegThreeWireMode; diff --git a/r8180_core.c b/r8180_core.c index 4e872d9..70373e9 100644 --- a/r8180_core.c +++ b/r8180_core.c @@ -2376,8 +2376,7 @@ short rtl8180_init(struct net_device *dev) { struct r8180_priv *priv = ieee80211_priv(dev); u16 word; - u16 version; - u32 usValue; + u16 usValue; u16 tmpu16; int i, j; struct eeprom_93cx6 eeprom; @@ -2614,36 +2613,31 @@ short rtl8180_init(struct net_device *dev) /* just for sync 85 */ priv->enable_gpio0 = 0; - eeprom_93cx6_read(&eeprom, EEPROM_SW_REVD_OFFSET, &eeprom_val); - usValue = eeprom_val; - DMESG("usValue is 0x%x\n", usValue); + eeprom_93cx6_read(&eeprom, EEPROM_SW_REVD_OFFSET, &usValue); + DMESG("usValue is %#hx\n", usValue); /* 3Read AntennaDiversity */ /* SW Antenna Diversity. */ - if ((usValue & EEPROM_SW_AD_MASK) != EEPROM_SW_AD_ENABLE) - priv->EEPROMSwAntennaDiversity = false; - else - priv->EEPROMSwAntennaDiversity = true; + priv->EEPROMSwAntennaDiversity = (usValue & EEPROM_SW_AD_MASK) == + EEPROM_SW_AD_ENABLE; /* Default Antenna to use. */ - if ((usValue & EEPROM_DEF_ANT_MASK) != EEPROM_DEF_ANT_1) - priv->EEPROMDefaultAntenna1 = false; - else - priv->EEPROMDefaultAntenna1 = true; + priv->EEPROMDefaultAntenna1 = (usValue & EEPROM_DEF_ANT_MASK) == + EEPROM_DEF_ANT_1; if (priv->RegSwAntennaDiversityMechanism == 0) /* Auto */ /* 0: default from EEPROM. */ priv->bSwAntennaDiverity = priv->EEPROMSwAntennaDiversity; else /* 1:disable antenna diversity, 2: enable antenna diversity. */ - priv->bSwAntennaDiverity = ((priv->RegSwAntennaDiversityMechanism == 1) ? false : true); + priv->bSwAntennaDiverity = priv->RegSwAntennaDiversityMechanism == 2; if (priv->RegDefaultAntenna == 0) /* 0: default from EEPROM. */ priv->bDefaultAntenna1 = priv->EEPROMDefaultAntenna1; else /* 1: main, 2: aux. */ - priv->bDefaultAntenna1 = ((priv->RegDefaultAntenna == 2) ? true : false); + priv->bDefaultAntenna1 = priv->RegDefaultAntenna == 2; /* rtl8185 can calc plcp len in HW. */ priv->hw_plcp_len = 1; @@ -2683,18 +2677,6 @@ short rtl8180_init(struct net_device *dev) if ((tmpu16 & EEPROM_THERMAL_METER_ENABLE) >> 13) priv->bTxPowerTrack = true; - eeprom_93cx6_read(&eeprom, EPROM_TXPW_BASE, &word); - priv->cck_txpwr_base = word & 0xf; - priv->ofdm_txpwr_base = (word>>4) & 0xf; - - eeprom_93cx6_read(&eeprom, EPROM_VERSION, &version); - DMESG("EEPROM version %x", version); - priv->rcr_csense = 3; - - eeprom_93cx6_read(&eeprom, ENERGY_TRESHOLD, &eeprom_val); - priv->cs_treshold = (eeprom_val & 0xff00) >> 8; - - eeprom_93cx6_read(&eeprom, RFCHIPID, &eeprom_val); priv->rf_sleep = rtl8225z4_rf_sleep; priv->rf_wakeup = rtl8225z4_rf_wakeup; DMESGW("**PLEASE** REPORT SUCCESSFUL/UNSUCCESSFUL TO Realtek!");