From patchwork Mon Nov 12 21:58:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Mikityanskiy X-Patchwork-Id: 1731241 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6AA22DFE80 for ; Mon, 12 Nov 2012 21:58:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753595Ab2KLV6z (ORCPT ); Mon, 12 Nov 2012 16:58:55 -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 S1752632Ab2KLV6y (ORCPT ); Mon, 12 Nov 2012 16:58:54 -0500 Received: by mail-ea0-f174.google.com with SMTP id o11so438703eaa.19 for ; Mon, 12 Nov 2012 13:58:53 -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=xPGy2at9FEo4ejDhvYSKNBUK2elHQKZDBOe9+Q2uC7U=; b=kp3jZamn025KIp9ZB6Q4CZZJw8JJNj7eIprPoRJ7XdYH+yKeh6Qg4sZPGMXA8iNhWF GBkGaqOsNLxnCgWDVDfbu63y8hiHeoRkWvkiOLKYjIaW1/UDvRKQVZrcEJCUQNqe9L/e kICvGL/6hR+XQkGlbDV7ED+C46fRwE5gfHIUNUrCBVsWIjZZ4y0NJh4Iktcc/bpDk2G1 Tx1kGsaqPQ6tQYPfNJ6dpDF6XFo84MAH3lKqzNi4dYg9SPIk7M/hH7s3RqHpKMIp0XdZ 39fG3R88Pja+1du6p3rh05DLXCxt9gLY3fm1mUf15x/OkgedKorRHYZEzzP1m4znpzIe RA4A== Received: by 10.14.1.69 with SMTP id 45mr67505293eec.23.1352757533377; Mon, 12 Nov 2012 13:58:53 -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.58.51 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Nov 2012 13:58:52 -0800 (PST) From: Maxim Mikityanskiy To: greg@kroah.com, linux-wireless@vger.kernel.org Cc: Maxim Mikityanskiy Subject: [PATCH 03/17] Removed empty functions and one-iteration loop Date: Mon, 12 Nov 2012 23:58:17 +0200 Message-Id: <1352757511-26957-4-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 --- r8185b_init.c | 210 ++++++++++++++++++++++++--------------------------------- 1 file changed, 89 insertions(+), 121 deletions(-) diff --git a/r8185b_init.c b/r8185b_init.c index 9144957..1ab8513 100644 --- a/r8185b_init.c +++ b/r8185b_init.c @@ -217,118 +217,115 @@ static int HwHSSIThreeWire(struct net_device *dev, u8 TryCnt; u8 u1bTmp; - do { - /* Check if WE and RE are cleared. */ - for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) { - u1bTmp = read_nic_byte(dev, SW_3W_CMD1); - if ((u1bTmp & (SW_3W_CMD1_RE|SW_3W_CMD1_WE)) == 0) - break; + /* Check if WE and RE are cleared. */ + for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) { + u1bTmp = read_nic_byte(dev, SW_3W_CMD1); + if ((u1bTmp & (SW_3W_CMD1_RE|SW_3W_CMD1_WE)) == 0) + break; - udelay(10); - } - if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) { - printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:" - " %#X RE|WE bits are not clear!!\n", u1bTmp); - dump_stack(); - return 0; - } + udelay(10); + } + if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) { + printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:" + " %#X RE|WE bits are not clear!!\n", u1bTmp); + dump_stack(); + return 0; + } - /* RTL8187S HSSI Read/Write Function */ - u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); + /* RTL8187S HSSI Read/Write Function */ + u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); - if (bSI) - u1bTmp |= RF_SW_CFG_SI; /* reg08[1]=1 Serial Interface(SI) */ + if (bSI) + u1bTmp |= RF_SW_CFG_SI; /* reg08[1]=1 Serial Interface(SI) */ - else - u1bTmp &= ~RF_SW_CFG_SI; /* reg08[1]=0 Parallel Interface(PI) */ + else + u1bTmp &= ~RF_SW_CFG_SI; /* reg08[1]=0 Parallel Interface(PI) */ - write_nic_byte(dev, RF_SW_CONFIG, u1bTmp); + write_nic_byte(dev, RF_SW_CONFIG, u1bTmp); - if (bSI) { - /* jong: HW SI read must set reg84[3]=0. */ - u1bTmp = read_nic_byte(dev, RFPinsSelect); - u1bTmp &= ~BIT3; - write_nic_byte(dev, RFPinsSelect, u1bTmp); - } - /* Fill up data buffer for write operation. */ - - if (bWrite) { - if (nDataBufBitCnt == 16) { - write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf)); - } else if (nDataBufBitCnt == 64) { - /* RTL8187S shouldn't enter this case */ - write_nic_dword(dev, SW_3W_DB0, *((u32 *)pDataBuf)); - write_nic_dword(dev, SW_3W_DB1, *((u32 *)(pDataBuf + 4))); - } else { - int idx; - int ByteCnt = nDataBufBitCnt / 8; - /* printk("%d\n",nDataBufBitCnt); */ - if ((nDataBufBitCnt % 8) != 0) { - printk(KERN_ERR "rtl8187se: " - "HwThreeWire(): nDataBufBitCnt(%d)" - " should be multiple of 8!!!\n", - nDataBufBitCnt); - dump_stack(); - nDataBufBitCnt += 8; - nDataBufBitCnt &= ~7; - } + if (bSI) { + /* jong: HW SI read must set reg84[3]=0. */ + u1bTmp = read_nic_byte(dev, RFPinsSelect); + u1bTmp &= ~BIT3; + write_nic_byte(dev, RFPinsSelect, u1bTmp); + } + /* Fill up data buffer for write operation. */ + + if (bWrite) { + if (nDataBufBitCnt == 16) { + write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf)); + } else if (nDataBufBitCnt == 64) { + /* RTL8187S shouldn't enter this case */ + write_nic_dword(dev, SW_3W_DB0, *((u32 *)pDataBuf)); + write_nic_dword(dev, SW_3W_DB1, *((u32 *)(pDataBuf + 4))); + } else { + int idx; + int ByteCnt = nDataBufBitCnt / 8; + /* printk("%d\n",nDataBufBitCnt); */ + if ((nDataBufBitCnt % 8) != 0) { + printk(KERN_ERR "rtl8187se: " + "HwThreeWire(): nDataBufBitCnt(%d)" + " should be multiple of 8!!!\n", + nDataBufBitCnt); + dump_stack(); + nDataBufBitCnt += 8; + nDataBufBitCnt &= ~7; + } - if (nDataBufBitCnt > 64) { - printk(KERN_ERR "rtl8187se: HwThreeWire():" - " nDataBufBitCnt(%d) should <= 64!!!\n", - nDataBufBitCnt); - dump_stack(); - nDataBufBitCnt = 64; - } + if (nDataBufBitCnt > 64) { + printk(KERN_ERR "rtl8187se: HwThreeWire():" + " nDataBufBitCnt(%d) should <= 64!!!\n", + nDataBufBitCnt); + dump_stack(); + nDataBufBitCnt = 64; + } - for (idx = 0; idx < ByteCnt; idx++) - write_nic_byte(dev, (SW_3W_DB0+idx), *(pDataBuf+idx)); + for (idx = 0; idx < ByteCnt; idx++) + write_nic_byte(dev, (SW_3W_DB0+idx), *(pDataBuf+idx)); - } - } else { /* read */ - if (bSI) { - /* SI - reg274[3:0] : RF register's Address */ - write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf)); - } else { - /* PI - reg274[15:12] : RF register's Address */ - write_nic_word(dev, SW_3W_DB0, (*((u16 *)pDataBuf)) << 12); - } } + } else { /* read */ + if (bSI) { + /* SI - reg274[3:0] : RF register's Address */ + write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf)); + } else { + /* PI - reg274[15:12] : RF register's Address */ + write_nic_word(dev, SW_3W_DB0, (*((u16 *)pDataBuf)) << 12); + } + } - /* Set up command: WE or RE. */ - if (bWrite) - write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_WE); + /* Set up command: WE or RE. */ + if (bWrite) + write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_WE); - else - write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_RE); + else + write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_RE); - /* Check if DONE is set. */ - for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) { - u1bTmp = read_nic_byte(dev, SW_3W_CMD1); - if ((u1bTmp & SW_3W_CMD1_DONE) != 0) - break; - - udelay(10); - } + /* Check if DONE is set. */ + for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) { + u1bTmp = read_nic_byte(dev, SW_3W_CMD1); + if ((u1bTmp & SW_3W_CMD1_DONE) != 0) + break; - write_nic_byte(dev, SW_3W_CMD1, 0); + udelay(10); + } - /* Read back data for read operation. */ - if (bWrite == 0) { - if (bSI) { - /* Serial Interface : reg363_362[11:0] */ - *((u16 *)pDataBuf) = read_nic_word(dev, SI_DATA_READ) ; - } else { - /* Parallel Interface : reg361_360[11:0] */ - *((u16 *)pDataBuf) = read_nic_word(dev, PI_DATA_READ); - } + write_nic_byte(dev, SW_3W_CMD1, 0); - *((u16 *)pDataBuf) &= 0x0FFF; + /* Read back data for read operation. */ + if (bWrite == 0) { + if (bSI) { + /* Serial Interface : reg363_362[11:0] */ + *((u16 *)pDataBuf) = read_nic_word(dev, SI_DATA_READ) ; + } else { + /* Parallel Interface : reg361_360[11:0] */ + *((u16 *)pDataBuf) = read_nic_word(dev, PI_DATA_READ); } - } while (0); + *((u16 *)pDataBuf) &= 0x0FFF; + } return bResult; } @@ -1148,18 +1145,11 @@ void rtl8185b_irq_enable(struct net_device *dev) write_nic_dword(dev, IMR, priv->IntrMask); } -void DrvIFIndicateDisassociation(struct net_device *dev, u16 reason) -{ - /* nothing is needed after disassociation request. */ -} - void MgntDisconnectIBSS(struct net_device *dev) { struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); u8 i; - DrvIFIndicateDisassociation(dev, unspec_reason); - for (i = 0; i < 6 ; i++) priv->ieee80211->current_network.bssid[i] = 0x55; @@ -1190,8 +1180,6 @@ void MlmeDisassociateRequest(struct net_device *dev, u8 *asSta, u8 asRsn) if (memcmp(priv->ieee80211->current_network.bssid, asSta, 6) == 0) { /* ShuChen TODO: change media status. */ - /* ShuChen TODO: What to do when disassociate. */ - DrvIFIndicateDisassociation(dev, unspec_reason); for (i = 0; i < 6; i++) priv->ieee80211->current_network.bssid[i] = 0x22; @@ -1267,14 +1255,6 @@ bool SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerState) return bResult; } -void HalEnableRx8185Dummy(struct net_device *dev) -{ -} - -void HalDisableRx8185Dummy(struct net_device *dev) -{ -} - bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u32 ChangeSource) { struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); @@ -1359,18 +1339,6 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u if (bActionAllowed) { /* Config HW to the specified mode. */ SetRFPowerState(dev, StateToSet); - - /* Turn on RF. */ - if (StateToSet == eRfOn) { - HalEnableRx8185Dummy(dev); - if (bConnectBySSID) { - /* by amy not supported */ - } - } - /* Turn off RF. */ - else if (StateToSet == eRfOff) - HalDisableRx8185Dummy(dev); - } /* Release RF spinlock */