Commit 35e33b04 authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Fix LONG_LINE warnings

Fix most of simple LONG_LINE warnings. None of the changes should affect
behaviour of code, so several modifications are included in this patch:
- Code is reindented where needed
- Local variable names are compacted (priv -> p)
- Unnecessary casts are removed
- Nested ifs are replaced with logical and
- a = b = c = d expressions are split
- Replace if/then series with clamp_t()
- Removed unneeded scopes
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7bdfaa0a
......@@ -74,8 +74,8 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src)
(GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \
ether_addr_equal_unaligned(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, \
__pTa)
ether_addr_equal_unaligned( \
GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \
cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
......
......@@ -30,7 +30,8 @@
#include "rtl_dm.h"
#include "rtl_wx.h"
static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO};
static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI,
EDCAPARA_VO};
void rtl8192e_start_beacon(struct net_device *dev)
{
......@@ -187,22 +188,21 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val)
u8 u1bAIFS;
u32 u4bAcParam;
u8 mode = priv->rtllib->mode;
struct rtllib_qos_parameters *qos_parameters =
struct rtllib_qos_parameters *qop =
&priv->rtllib->current_network.qos_data.parameters;
u1bAIFS = qos_parameters->aifs[pAcParam] *
u1bAIFS = qop->aifs[pAcParam] *
((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
dm_init_edca_turbo(dev);
u4bAcParam = (((le16_to_cpu(
qos_parameters->tx_op_limit[pAcParam])) <<
AC_PARAM_TXOP_LIMIT_OFFSET) |
((le16_to_cpu(qos_parameters->cw_max[pAcParam])) <<
AC_PARAM_ECW_MAX_OFFSET) |
((le16_to_cpu(qos_parameters->cw_min[pAcParam])) <<
AC_PARAM_ECW_MIN_OFFSET) |
(((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET));
u4bAcParam = (le16_to_cpu(qop->tx_op_limit[pAcParam]) <<
AC_PARAM_TXOP_LIMIT_OFFSET) |
((le16_to_cpu(qop->cw_max[pAcParam])) <<
AC_PARAM_ECW_MAX_OFFSET) |
((le16_to_cpu(qop->cw_min[pAcParam])) <<
AC_PARAM_ECW_MIN_OFFSET) |
(((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET);
RT_TRACE(COMP_DBG, "%s():HW_VAR_AC_PARAM eACI:%x:%x\n",
__func__, eACI, u4bAcParam);
......
......@@ -230,7 +230,7 @@ bool init_firmware(struct net_device *dev)
u32 file_length = 0;
u8 *mapped_file = NULL;
u8 init_step = 0;
u8 i = 0;
enum opt_rst_type rst_opt = OPT_SYSTEM_RESET;
enum firmware_init_step starting_state = FW_INIT_STEP0_BOOT;
......@@ -250,10 +250,9 @@ bool init_firmware(struct net_device *dev)
"PlatformInitFirmware: undefined firmware state\n");
}
for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA;
init_step++) {
for (i = starting_state; i <= FW_INIT_STEP2_DATA; i++) {
if (rst_opt == OPT_SYSTEM_RESET) {
if (pfirmware->firmware_buf_size[init_step] == 0) {
if (pfirmware->firmware_buf_size[i] == 0) {
const char *fw_name[3] = {
RTL8192E_BOOT_IMG_FW,
RTL8192E_MAIN_IMG_FW,
......@@ -263,7 +262,7 @@ bool init_firmware(struct net_device *dev)
int rc;
rc = request_firmware(&fw_entry,
fw_name[init_step],
fw_name[i],
&priv->pdev->dev);
if (rc < 0) {
RT_TRACE(COMP_FIRMWARE,
......@@ -271,24 +270,24 @@ bool init_firmware(struct net_device *dev)
goto download_firmware_fail;
}
if (fw_entry->size >
sizeof(pfirmware->firmware_buf[init_step])) {
sizeof(pfirmware->firmware_buf[i])) {
RT_TRACE(COMP_FIRMWARE,
"img file size exceed the container struct buffer fail!\n");
goto download_firmware_fail;
}
if (init_step != FW_INIT_STEP1_MAIN) {
memcpy(pfirmware->firmware_buf[init_step],
if (i != FW_INIT_STEP1_MAIN) {
memcpy(pfirmware->firmware_buf[i],
fw_entry->data, fw_entry->size);
pfirmware->firmware_buf_size[init_step] =
pfirmware->firmware_buf_size[i] =
fw_entry->size;
} else {
memset(pfirmware->firmware_buf[init_step],
memset(pfirmware->firmware_buf[i],
0, 128);
memcpy(&pfirmware->firmware_buf[init_step][128],
memcpy(&pfirmware->firmware_buf[i][128],
fw_entry->data, fw_entry->size);
pfirmware->firmware_buf_size[init_step] =
pfirmware->firmware_buf_size[i] =
fw_entry->size + 128;
}
......@@ -297,14 +296,14 @@ bool init_firmware(struct net_device *dev)
}
}
mapped_file = pfirmware->firmware_buf[init_step];
file_length = pfirmware->firmware_buf_size[init_step];
mapped_file = pfirmware->firmware_buf[i];
file_length = pfirmware->firmware_buf_size[i];
rt_status = fw_download_code(dev, mapped_file, file_length);
if (!rt_status)
goto download_firmware_fail;
if (!firmware_check_ready(dev, init_step))
if (!firmware_check_ready(dev, i))
goto download_firmware_fail;
}
......
......@@ -628,8 +628,8 @@ void rtl8192_phy_getTxPower(struct net_device *dev)
priv->DefaultInitialGain[3] = read_nic_byte(dev, rOFDM0_XDAGCCore1);
RT_TRACE(COMP_INIT,
"Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n",
priv->DefaultInitialGain[0], priv->DefaultInitialGain[1],
priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]);
priv->DefaultInitialGain[0], priv->DefaultInitialGain[1],
priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]);
priv->framesync = read_nic_byte(dev, rOFDM0_RxDetector3);
priv->framesyncC34 = read_nic_dword(dev, rOFDM0_RxDetector2);
......
......@@ -2068,8 +2068,7 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)
int i, rx_queue_idx;
for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
priv->rx_ring[rx_queue_idx] =
pci_zalloc_consistent(priv->pdev,
priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
&priv->rx_ring_dma[rx_queue_idx]);
if (!priv->rx_ring[rx_queue_idx] ||
......
This diff is collapsed.
......@@ -613,7 +613,8 @@ static int r8192_wx_set_nick(struct net_device *dev,
if (wrqu->data.length > IW_ESSID_MAX_SIZE)
return -E2BIG;
down(&priv->wx_sem);
wrqu->data.length = min_t(size_t, wrqu->data.length, sizeof(priv->nick));
wrqu->data.length = min_t(size_t, wrqu->data.length,
sizeof(priv->nick));
memset(priv->nick, 0, sizeof(priv->nick));
memcpy(priv->nick, extra, wrqu->data.length);
up(&priv->wx_sem);
......
......@@ -236,7 +236,8 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee)
return false;
}
static u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee, u8 *PeerMacAddr)
static u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee,
u8 *PeerMacAddr)
{
return false;
}
......
......@@ -49,8 +49,10 @@ static void RxPktPendingTimeout(unsigned long data)
if (index == 0)
pRxTs->RxIndicateSeq = pReorderEntry->SeqNum;
if (SN_LESS(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) ||
SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq)) {
if (SN_LESS(pReorderEntry->SeqNum,
pRxTs->RxIndicateSeq) ||
SN_EQUAL(pReorderEntry->SeqNum,
pRxTs->RxIndicateSeq)) {
list_del_init(&pReorderEntry->List);
if (SN_EQUAL(pReorderEntry->SeqNum,
......@@ -92,7 +94,8 @@ static void RxPktPendingTimeout(unsigned long data)
if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq == 0xffff)) {
pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq;
mod_timer(&pRxTs->RxPktPendingTimer, jiffies +
msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime));
msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)
);
}
spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
}
......@@ -269,10 +272,10 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
if (!search_dir[dir])
continue;
list_for_each_entry(pRet, psearch_list, List) {
if (memcmp(pRet->Addr, Addr, 6) == 0)
if (pRet->TSpec.f.TSInfo.field.ucTSID == TID)
if (pRet->TSpec.f.TSInfo.field.ucDirection == dir)
break;
if (memcmp(pRet->Addr, Addr, 6) == 0 &&
pRet->TSpec.f.TSInfo.field.ucTSID == TID &&
pRet->TSpec.f.TSInfo.field.ucDirection == dir)
break;
}
if (&pRet->List != psearch_list)
......@@ -415,8 +418,8 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
return false;
}
static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs,
enum tr_select TxRxSelect)
static void RemoveTsEntry(struct rtllib_device *ieee,
struct ts_common_info *pTs, enum tr_select TxRxSelect)
{
del_timer_sync(&pTs->SetupTimer);
del_timer_sync(&pTs->InactTimer);
......
This diff is collapsed.
......@@ -272,9 +272,10 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee)
ieee->seq_ctrl[0]++;
/* check whether the managed packet queued greater than 5 */
if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) ||
(skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) ||
(ieee->queue_stop)) {
if (!ieee->check_nic_enough_desc(ieee->dev,
tcb_desc->queue_index) ||
skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) ||
ieee->queue_stop) {
/* insert the skb packet to the management queue
*
* as for the completion function, it does not need
......@@ -1483,7 +1484,8 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr)
}
}
static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge, int chlen)
static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge,
int chlen)
{
u8 *c;
struct sk_buff *skb;
......@@ -1740,7 +1742,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
/* Join the network for the first time */
ieee->AsocRetryCount = 0;
if ((ieee->current_network.qos_data.supported == 1) &&
ieee->current_network.bssht.bdSupportHT)
ieee->current_network.bssht.bdSupportHT)
HTResetSelfAndSavePeerSetting(ieee,
&(ieee->current_network));
else
......@@ -1755,14 +1757,19 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
&ieee->associate_procedure_wq, 0);
} else {
if (rtllib_is_54g(&ieee->current_network) &&
(ieee->modulation & RTLLIB_OFDM_MODULATION)) {
(ieee->modulation &
RTLLIB_OFDM_MODULATION)) {
ieee->rate = 108;
ieee->SetWirelessMode(ieee->dev, IEEE_G);
netdev_info(ieee->dev, "Using G rates\n");
ieee->SetWirelessMode(ieee->dev,
IEEE_G);
netdev_info(ieee->dev,
"Using G rates\n");
} else {
ieee->rate = 22;
ieee->SetWirelessMode(ieee->dev, IEEE_B);
netdev_info(ieee->dev, "Using B rates\n");
ieee->SetWirelessMode(ieee->dev,
IEEE_B);
netdev_info(ieee->dev,
"Using B rates\n");
}
memset(ieee->dot11HTOperationalRateSet, 0, 16);
ieee->state = RTLLIB_LINKED;
......@@ -2023,7 +2030,7 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)
if (ieee->bAwakePktSent) {
pPSC->LPSAwakeIntvl = 1;
} else {
u8 MaxPeriod = 1;
u8 MaxPeriod = 1;
if (pPSC->LPSAwakeIntvl == 0)
pPSC->LPSAwakeIntvl = 1;
......@@ -2194,7 +2201,8 @@ void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success)
}
EXPORT_SYMBOL(rtllib_ps_tx_ack);
static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *skb)
static void rtllib_process_action(struct rtllib_device *ieee,
struct sk_buff *skb)
{
struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data;
u8 *act = rtllib_get_payload((struct rtllib_hdr *)header);
......@@ -3674,8 +3682,8 @@ static void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib)
}
static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta,
u8 asRsn)
static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib,
u8 *asSta, u8 asRsn)
{
u8 i;
u8 OpMode;
......
......@@ -57,18 +57,19 @@
*
*
* 802.11 frame_control for data frames - 2 bytes
* ,-----------------------------------------------------------------------------------------.
* bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e |
* |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
* val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x |
* |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
* desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep |
* | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | |
* '-----------------------------------------------------------------------------------------'
* /\
* |
* 802.11 Data Frame |
* ,--------- 'ctrl' expands to >-----------'
* ,--------------------------------------------------------------------.
* bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e |
* |---|---|---|---|---|---|---|---|---|----|----|-----|-----|-----|----|
* val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x |
* |---|---|---|---|---|---|---|---|---|----|----|-----|-----|-----|----|
* desc | ver | type | ^-subtype-^ |to |from|more|retry| pwr |more |wep |
* | | | x=0 data |DS | DS |frag| | mgm |data | |
* | | | x=1 data+ack | | | | | | | |
* '--------------------------------------------------------------------'
* /\
* |
* 802.11 Data Frame |
* ,--------- 'ctrl' expands to >---'
* |
* ,--'---,-------------------------------------------------------------.
* Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
......@@ -112,15 +113,15 @@
* `-----------------------------------------'
* Total: 18 non-data bytes
*
* In the event that fragmentation is required, the incoming payload is split into
* N parts of size ieee->fts. The first fragment contains the SNAP header and the
* remaining packets are just data.
* In the event that fragmentation is required, the incoming payload is split
* into N parts of size ieee->fts. The first fragment contains the SNAP header
* and the remaining packets are just data.
*
* If encryption is enabled, each fragment payload size is reduced by enough space
* to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP)
* So if you have 1500 bytes of payload with ieee->fts set to 500 without
* encryption it will take 3 frames. With WEP it will take 4 frames as the
* payload of each frame is reduced to 492 bytes.
* If encryption is enabled, each fragment payload size is reduced by enough
* space to add the prefix and postfix (IV and ICV totalling 8 bytes in
* the case of WEP) So if you have 1500 bytes of payload with ieee->fts set to
* 500 without encryption it will take 3 frames. With WEP it will take 4 frames
* as the payload of each frame is reduced to 492 bytes.
*
* SKB visualization
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment