diff options
author | Mateusz Kulikowski <mateusz.kulikowski@gmail.com> | 2015-04-01 00:24:26 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-03 15:29:29 +0200 |
commit | 285b7c00e06b4fdd6e9ac63b9b8082508340f1ab (patch) | |
tree | 55f437e175ad2677f0553f98be62f4d7d96146c2 /drivers/staging | |
parent | 28eb1f3b640f793371a7cac599f3ac0f89f63b54 (diff) |
staging: rtl8192e: Fix UNNECESSARY_ELSE warning
Fix checkpatch warnings 'else is not generally useful after a break or return'
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 72 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 7 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 213 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 307 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 9 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 24 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl819x_HTProc.c | 31 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl819x_TSProc.c | 120 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_rx.c | 118 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_softmac.c | 11 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_tx.c | 78 |
12 files changed, 482 insertions, 518 deletions
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 170ff12c450a..9222e421f123 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -2025,6 +2025,7 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); + struct rx_fwinfo *pDrvInfo = NULL; stats->bICV = pdesc->ICV; stats->bCRC = pdesc->CRC32; @@ -2046,51 +2047,49 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev, priv->stats.rxcrcerrmid++; } return false; - } else { - struct rx_fwinfo *pDrvInfo = NULL; + } - stats->RxDrvInfoSize = pdesc->RxDrvInfoSize; - stats->RxBufShift = ((pdesc->Shift)&0x03); - stats->Decrypted = !pdesc->SWDec; + stats->RxDrvInfoSize = pdesc->RxDrvInfoSize; + stats->RxBufShift = ((pdesc->Shift)&0x03); + stats->Decrypted = !pdesc->SWDec; - pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift); + pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift); - stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT, - (u8)pDrvInfo->RxRate); - stats->bShortPreamble = pDrvInfo->SPLCP; + stats->rate = HwRateToMRate90((bool)pDrvInfo->RxHT, + (u8)pDrvInfo->RxRate); + stats->bShortPreamble = pDrvInfo->SPLCP; - rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats); + rtl8192_UpdateReceivedRateHistogramStatistics(dev, stats); - stats->bIsAMPDU = (pDrvInfo->PartAggr == 1); - stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) && - (pDrvInfo->FirstAGGR == 1); + stats->bIsAMPDU = (pDrvInfo->PartAggr == 1); + stats->bFirstMPDU = (pDrvInfo->PartAggr == 1) && + (pDrvInfo->FirstAGGR == 1); - stats->TimeStampLow = pDrvInfo->TSFL; - stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); + stats->TimeStampLow = pDrvInfo->TSFL; + stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); - rtl819x_UpdateRxPktTimeStamp(dev, stats); + rtl819x_UpdateRxPktTimeStamp(dev, stats); - if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) - stats->bShift = 1; + if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) + stats->bShift = 1; - stats->RxIs40MHzPacket = pDrvInfo->BW; + stats->RxIs40MHzPacket = pDrvInfo->BW; - rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc, - pDrvInfo); + rtl8192_TranslateRxSignalStuff(dev, skb, stats, pdesc, + pDrvInfo); - if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1) - RT_TRACE(COMP_RXDESC, - "pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n", - pDrvInfo->FirstAGGR, pDrvInfo->PartAggr); - skb_trim(skb, skb->len - 4/*sCrcLng*/); + if (pDrvInfo->FirstAGGR == 1 || pDrvInfo->PartAggr == 1) + RT_TRACE(COMP_RXDESC, + "pDrvInfo->FirstAGGR = %d, pDrvInfo->PartAggr = %d\n", + pDrvInfo->FirstAGGR, pDrvInfo->PartAggr); + skb_trim(skb, skb->len - 4/*sCrcLng*/); - stats->packetlength = stats->Length-4; - stats->fraglength = stats->packetlength; - stats->fragoffset = 0; - stats->ntotalfrag = 1; - return true; - } + stats->packetlength = stats->Length-4; + stats->fraglength = stats->packetlength; + stats->fragoffset = 0; + stats->ntotalfrag = 1; + return true; } void rtl8192_halt_adapter(struct net_device *dev, bool reset) @@ -2314,8 +2313,7 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev) (priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M)))) { if (rx_chk_cnt < 2) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } else if ((((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) && (priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_40M)) || ((priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) && @@ -2323,13 +2321,11 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev) priv->undecorated_smoothed_pwdb >= VeryLowRSSI) { if (rx_chk_cnt < 4) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } else { if (rx_chk_cnt < 8) return bStuck; - else - rx_chk_cnt = 0; + rx_chk_cnt = 0; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 1d9b7a17cbde..312979f8fd7e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -940,13 +940,11 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, } if (CurrentCmd && CurrentCmd->CmdID == CmdID_End) { - if ((*stage) == 2) { + if ((*stage) == 2) return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } + (*stage)++; + (*step) = 0; + continue; } if (!CurrentCmd) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index 8b5f6085697e..41b025e250fe 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -116,11 +116,10 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", __func__); return; - } else { - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } priv->rtllib->is_set_key = true; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index bcf7a9d822e2..5f3e28b22d7c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -204,19 +204,18 @@ u8 read_nic_io_byte(struct net_device *dev, int x) bool bIsLegalPage = false; u8 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return 0xff&inb(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_byte(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - } + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); + + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_byte(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -229,20 +228,17 @@ u16 read_nic_io_word(struct net_device *dev, int x) bool bIsLegalPage = false; u16 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return inw(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_word(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); - - } + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_word(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -255,20 +251,17 @@ u32 read_nic_io_dword(struct net_device *dev, int x) bool bIsLegalPage = false; u32 Data = 0; - if (u4bPage == 0) { + if (u4bPage == 0) return inl(dev->base_addr + x); - } else { - bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, - &u1PageMask); - if (bIsLegalPage) { - u8 u1bPsr = read_nic_io_byte(dev, PSR); - - write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | - (u8)u4bPage)); - Data = read_nic_io_dword(dev, (x & 0xff)); - write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); + bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage, + &u1PageMask); + if (bIsLegalPage) { + u8 u1bPsr = read_nic_io_byte(dev, PSR); - } + write_nic_io_byte(dev, PSR, ((u1bPsr & u1PageMask) | + (u8)u4bPage)); + Data = read_nic_io_dword(dev, (x & 0xff)); + write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask)); } return Data; @@ -1331,11 +1324,11 @@ static short rtl8192_init(struct net_device *dev) dev->name, dev)) { netdev_err(dev, "Error allocating IRQ %d", dev->irq); return -1; - } else { - priv->irq = dev->irq; - RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq); } + priv->irq = dev->irq; + RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq); + if (rtl8192_pci_initdescring(dev) != 0) { netdev_err(dev, "Endopoints initialization failed"); free_irq(dev->irq, dev); @@ -1932,17 +1925,16 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (queue_index == TXCMD_QUEUE) { rtl8192_tx_cmd(dev, skb); return 0; - } else { - tcb_desc->RATRIndex = 7; - tcb_desc->bTxDisableRateFallBack = 1; - tcb_desc->bTxUseDriverAssingedRate = 1; - tcb_desc->bTxEnableFwCalcDur = 1; - skb_push(skb, priv->rtllib->tx_headroom); - ret = rtl8192_tx(dev, skb); - if (ret != 0) - kfree_skb(skb); } + tcb_desc->RATRIndex = 7; + tcb_desc->bTxDisableRateFallBack = 1; + tcb_desc->bTxUseDriverAssingedRate = 1; + tcb_desc->bTxEnableFwCalcDur = 1; + skb_push(skb, priv->rtllib->tx_headroom); + ret = rtl8192_tx(dev, skb); + if (ret != 0) + kfree_skb(skb); return ret; } @@ -2338,76 +2330,73 @@ static void rtl8192_rx_normal(struct net_device *dev) [priv->rx_idx[rx_queue_idx]]; struct sk_buff *skb = priv->rx_buf[rx_queue_idx] [priv->rx_idx[rx_queue_idx]]; + struct sk_buff *new_skb; - if (pdesc->OWN) { + if (pdesc->OWN) return; - } else { - struct sk_buff *new_skb; - - if (!priv->ops->rx_query_status_descriptor(dev, &stats, - pdesc, skb)) - goto done; - new_skb = dev_alloc_skb(priv->rxbuffersize); - /* if allocation of new skb failed - drop current packet - * and reuse skb */ - if (unlikely(!new_skb)) - goto done; - - pci_unmap_single(priv->pdev, - *((dma_addr_t *)skb->cb), - priv->rxbuffersize, - PCI_DMA_FROMDEVICE); - - skb_put(skb, pdesc->Length); - skb_reserve(skb, stats.RxDrvInfoSize + - stats.RxBufShift); - skb_trim(skb, skb->len - 4/*sCrcLng*/); - rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data; - if (!is_multicast_ether_addr(rtllib_hdr->addr1)) { - /* unicast packet */ - unicast_packet = true; - } - fc = le16_to_cpu(rtllib_hdr->frame_ctl); - type = WLAN_FC_GET_TYPE(fc); - if (type == RTLLIB_FTYPE_MGMT) - bLedBlinking = false; - - if (bLedBlinking) - if (priv->rtllib->LedControlHandler) - priv->rtllib->LedControlHandler(dev, - LED_CTL_RX); - - if (stats.bCRC) { - if (type != RTLLIB_FTYPE_MGMT) - priv->stats.rxdatacrcerr++; - else - priv->stats.rxmgmtcrcerr++; - } - - skb_len = skb->len; + if (!priv->ops->rx_query_status_descriptor(dev, &stats, + pdesc, skb)) + goto done; + new_skb = dev_alloc_skb(priv->rxbuffersize); + /* if allocation of new skb failed - drop current packet + * and reuse skb */ + if (unlikely(!new_skb)) + goto done; + + pci_unmap_single(priv->pdev, + *((dma_addr_t *)skb->cb), + priv->rxbuffersize, + PCI_DMA_FROMDEVICE); + + skb_put(skb, pdesc->Length); + skb_reserve(skb, stats.RxDrvInfoSize + + stats.RxBufShift); + skb_trim(skb, skb->len - 4/*sCrcLng*/); + rtllib_hdr = (struct rtllib_hdr_1addr *)skb->data; + if (!is_multicast_ether_addr(rtllib_hdr->addr1)) { + /* unicast packet */ + unicast_packet = true; + } + fc = le16_to_cpu(rtllib_hdr->frame_ctl); + type = WLAN_FC_GET_TYPE(fc); + if (type == RTLLIB_FTYPE_MGMT) + bLedBlinking = false; + + if (bLedBlinking) + if (priv->rtllib->LedControlHandler) + priv->rtllib->LedControlHandler(dev, + LED_CTL_RX); + + if (stats.bCRC) { + if (type != RTLLIB_FTYPE_MGMT) + priv->stats.rxdatacrcerr++; + else + priv->stats.rxmgmtcrcerr++; + } - if (!rtllib_rx(priv->rtllib, skb, &stats)) { - dev_kfree_skb_any(skb); - } else { - priv->stats.rxok++; - if (unicast_packet) - priv->stats.rxbytesunicast += skb_len; - } + skb_len = skb->len; - skb = new_skb; - skb->dev = dev; + if (!rtllib_rx(priv->rtllib, skb, &stats)) { + dev_kfree_skb_any(skb); + } else { + priv->stats.rxok++; + if (unicast_packet) + priv->stats.rxbytesunicast += skb_len; + } - priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = - skb; - *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, - skb_tail_pointer_rsl(skb), - priv->rxbuffersize, - PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(priv->pdev, - *((dma_addr_t *)skb->cb))) { - dev_kfree_skb_any(skb); - return; - } + skb = new_skb; + skb->dev = dev; + + priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = + skb; + *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, + skb_tail_pointer_rsl(skb), + priv->rxbuffersize, + PCI_DMA_FROMDEVICE); + if (pci_dma_mapping_error(priv->pdev, + *((dma_addr_t *)skb->cb))) { + dev_kfree_skb_any(skb); + return; } done: pdesc->BufferAddress = *((dma_addr_t *)skb->cb); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index aa95e88a6931..b26dfcbc3e3b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -378,19 +378,16 @@ static void dm_bandwidth_autoswitch(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || - !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) { + !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) return; + if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) { + if (priv->undecorated_smoothed_pwdb <= + priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true; } else { - if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) { - if (priv->undecorated_smoothed_pwdb <= - priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz) - priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true; - } else { - if (priv->undecorated_smoothed_pwdb >= - priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz) - priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false; - - } + if (priv->undecorated_smoothed_pwdb >= + priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false; } } @@ -581,148 +578,148 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) "priv->CCKPresentAttentuation = %d\n", priv->CCKPresentAttentuation); return; - } else { - if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { - if (RF_Type == RF_2T4R) { - - if ((priv->rfa_txpowertrackingindex > 0) && - (priv->rfc_txpowertrackingindex > 0)) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } - - priv->rfc_txpowertrackingindex--; - if (priv->rfc_txpowertrackingindex_real > 4) { - priv->rfc_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); - } - } else { - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[4].txbbgain_value); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, priv->txbbgain_table[4].txbbgain_value); - } - } else { - if (priv->rfa_txpowertrackingindex > 0) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { + if (RF_Type == RF_2T4R) { - } - } else { - if (RF_Type == RF_2T4R) { - if ((priv->rfa_txpowertrackingindex < - TxBBGainTableLength - 1) && - (priv->rfc_txpowertrackingindex < - TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; + if ((priv->rfa_txpowertrackingindex > 0) && + (priv->rfc_txpowertrackingindex > 0)) { + priv->rfa_txpowertrackingindex--; + if (priv->rfa_txpowertrackingindex_real > 4) { + priv->rfa_txpowertrackingindex_real--; rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, - priv->txbbgain_table - [priv->rfa_txpowertrackingindex_real].txbbgain_value); - priv->rfc_txpowertrackingindex++; - priv->rfc_txpowertrackingindex_real++; + priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); + } + + priv->rfc_txpowertrackingindex--; + if (priv->rfc_txpowertrackingindex_real > 4) { + priv->rfc_txpowertrackingindex_real--; rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); - } else { - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); } } else { - if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[4].txbbgain_value); + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + } else { + if (priv->rfa_txpowertrackingindex > 0) { + priv->rfa_txpowertrackingindex--; + if (priv->rfa_txpowertrackingindex_real > 4) { + priv->rfa_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); - } + } + } else + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, priv->txbbgain_table[4].txbbgain_value); + } + } else { if (RF_Type == RF_2T4R) { - priv->CCKPresentAttentuation_difference - = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; + if ((priv->rfa_txpowertrackingindex < + TxBBGainTableLength - 1) && + (priv->rfc_txpowertrackingindex < + TxBBGainTableLength - 1)) { + priv->rfa_txpowertrackingindex++; + priv->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table + [priv->rfa_txpowertrackingindex_real].txbbgain_value); + priv->rfc_txpowertrackingindex++; + priv->rfc_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, + priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); + } else { + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); + } } else { - priv->CCKPresentAttentuation_difference - = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; - } - - if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) - priv->CCKPresentAttentuation = - priv->CCKPresentAttentuation_20Mdefault + - priv->CCKPresentAttentuation_difference; - else - priv->CCKPresentAttentuation = - priv->CCKPresentAttentuation_40Mdefault + - priv->CCKPresentAttentuation_difference; - - if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1)) - priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1; - if (priv->CCKPresentAttentuation < 0) - priv->CCKPresentAttentuation = 0; - - if (priv->CCKPresentAttentuation > -1 && - priv->CCKPresentAttentuation < CCKTxBBGainTableLength) { - if (priv->rtllib->current_network.channel == 14 && - !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = true; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); - } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = false; - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { + priv->rfa_txpowertrackingindex++; + priv->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); } else - dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value); } - RT_TRACE(COMP_POWER_TRACKING, - "priv->rfa_txpowertrackingindex = %d\n", - priv->rfa_txpowertrackingindex); - RT_TRACE(COMP_POWER_TRACKING, - "priv->rfa_txpowertrackingindex_real = %d\n", - priv->rfa_txpowertrackingindex_real); - RT_TRACE(COMP_POWER_TRACKING, - "priv->CCKPresentAttentuation_difference = %d\n", - priv->CCKPresentAttentuation_difference); - RT_TRACE(COMP_POWER_TRACKING, - "priv->CCKPresentAttentuation = %d\n", - priv->CCKPresentAttentuation); + } + if (RF_Type == RF_2T4R) { + priv->CCKPresentAttentuation_difference + = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; + } else { + priv->CCKPresentAttentuation_difference + = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; + } - if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) { - priv->rtllib->bdynamic_txpower_enable = true; - write_nic_byte(dev, Pw_Track_Flag, 0); - write_nic_byte(dev, FW_Busy_Flag, 0); - RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); - return; - } + if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + priv->CCKPresentAttentuation = + priv->CCKPresentAttentuation_20Mdefault + + priv->CCKPresentAttentuation_difference; + else + priv->CCKPresentAttentuation = + priv->CCKPresentAttentuation_40Mdefault + + priv->CCKPresentAttentuation_difference; + + if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1)) + priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1; + if (priv->CCKPresentAttentuation < 0) + priv->CCKPresentAttentuation = 0; + + if (priv->CCKPresentAttentuation > -1 && + priv->CCKPresentAttentuation < CCKTxBBGainTableLength) { + if (priv->rtllib->current_network.channel == 14 && + !priv->bcck_in_ch14) { + priv->bcck_in_ch14 = true; + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) { + priv->bcck_in_ch14 = false; + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } else + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex = %d\n", + priv->rfa_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, + "priv->rfa_txpowertrackingindex_real = %d\n", + priv->rfa_txpowertrackingindex_real); + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation_difference = %d\n", + priv->CCKPresentAttentuation_difference); + RT_TRACE(COMP_POWER_TRACKING, + "priv->CCKPresentAttentuation = %d\n", + priv->CCKPresentAttentuation); + + if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) { + priv->rtllib->bdynamic_txpower_enable = true; + write_nic_byte(dev, Pw_Track_Flag, 0); + write_nic_byte(dev, FW_Busy_Flag, 0); + RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); + return; } + write_nic_byte(dev, Pw_Track_Flag, 0); Avg_TSSI_Meas_from_driver = 0; for (k = 0; k < 5; k++) @@ -1401,13 +1398,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) TxPowerCheckCnt = 5; else TxPowerCheckCnt = 2; - if (!priv->btxpower_tracking) { + if (!priv->btxpower_tracking) + return; + + if (priv->txpower_count <= TxPowerCheckCnt) { + priv->txpower_count++; return; - } else { - if (priv->txpower_count <= TxPowerCheckCnt) { - priv->txpower_count++; - return; - } } if (!TM_Trigger) { @@ -1419,15 +1415,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) } TM_Trigger = 1; return; - } else { - netdev_info(dev, - "===============>Schedule TxPowerTrackingWorkItem\n"); - - queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0); - TM_Trigger = 0; - } - } + netdev_info(dev, "===============>Schedule TxPowerTrackingWorkItem\n"); + queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0); + TM_Trigger = 0; + +} static void dm_check_txpower_tracking(struct net_device *dev) { @@ -1835,8 +1828,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( if (dm_digtable.dig_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt)) return; - else - reset_cnt = priv->reset_count; + reset_cnt = priv->reset_count; dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; dm_digtable.dig_state = DM_STA_DIG_OFF; @@ -1865,12 +1857,11 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( (priv->reset_count == reset_cnt)) { dm_ctrl_initgain_byrssi_highpwr(dev); return; - } else { - if (priv->reset_count != reset_cnt) - reset_flag = 1; - - reset_cnt = priv->reset_count; } + if (priv->reset_count != reset_cnt) + reset_flag = 1; + + reset_cnt = priv->reset_count; dm_digtable.dig_state = DM_STA_DIG_ON; @@ -1912,8 +1903,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON && (priv->reset_count == reset_cnt_highpwr)) return; - else - dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; + dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); @@ -1923,8 +1913,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev) if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF && (priv->reset_count == reset_cnt_highpwr)) return; - else - dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; + dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh && priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 40c3be9a5e54..0bbffec0c2ae 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -202,12 +202,11 @@ void rtllib_ips_leave_wq(struct net_device *dev) RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", __func__); return; - } else { - netdev_info(dev, "=========>%s(): IPSLeave\n", - __func__); - queue_work_rsl(priv->rtllib->wq, - &priv->rtllib->ips_leave_wq); } + netdev_info(dev, "=========>%s(): IPSLeave\n", + __func__); + queue_work_rsl(priv->rtllib->wq, + &priv->rtllib->ips_leave_wq); } } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index d074f974fe11..04f1f26b83c5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -346,14 +346,12 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, __func__); up(&priv->wx_sem); return -1; - } else { - netdev_info(dev, - "=========>%s(): IPSLeave\n", - __func__); - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + netdev_info(dev, "=========>%s(): IPSLeave\n", + __func__); + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } } @@ -509,14 +507,12 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, __func__); up(&priv->wx_sem); return -1; - } else { - RT_TRACE(COMP_PS, - "=========>%s(): IPSLeave\n", - __func__); - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); } + RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n", + __func__); + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); } } rtllib_stop_scan(priv->rtllib); diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 9820dd2df5f3..573325cbd2e1 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -135,25 +135,22 @@ u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate) u8 is40MHz = 0; u8 isShortGI = 0; - if (nDataRate < 12) { + if (nDataRate < 12) return CCKOFDMRate[nDataRate]; - } else { - if (nDataRate >= 0x10 && nDataRate <= 0x1f) { - is40MHz = 0; |