From: Xenia Ragiadakou Date: Wed, 26 Jun 2013 01:21:42 +0000 (+0300) Subject: staging: rtl8192u: fix whitespace in r819xU_cmdpkt.c X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fa6b108bb17558d721c5adfa48fc309388cd0230;p=openwrt%2Fstaging%2Fblogic.git staging: rtl8192u: fix whitespace in r819xU_cmdpkt.c This patch fixes whitespaces in r819xU_cmdpkt.c to follow the kernel coding style and to improve code readability. It fixes the spaces around <,=||&&();} and adds or removes tabs to better align variables. Signed-off-by: Xenia Ragiadakou Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index fd69da732d82..777286beffb3 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -33,17 +33,12 @@ u32 temp[10];\ \ memcpy(temp, Address, 40);\ - for (i = 0; i <40; i+=4)\ + for (i = 0; i < 40; i += 4)\ printk("\r\n %08x", temp[i]);\ }\ /*---------------------------Define functions---------------------------------*/ -rt_status -SendTxCommandPacket( - struct net_device *dev, - void *pData, - u32 DataLen - ) +rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) { rt_status rtStatus = RT_STATUS_SUCCESS; struct r8192_priv *priv = ieee80211_priv(dev); @@ -53,23 +48,23 @@ SendTxCommandPacket( //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + DataLen + 4); - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL; tcb_desc->bLastIniPkt = 0; skb_reserve(skb, USB_HWDESC_HEADER_LEN); ptr_buf = skb_put(skb, DataLen); - memcpy(ptr_buf,pData,DataLen); - tcb_desc->txbuf_size= (u16)DataLen; + memcpy(ptr_buf, pData, DataLen); + tcb_desc->txbuf_size = (u16)DataLen; - if (!priv->ieee80211->check_nic_enough_desc(dev,tcb_desc->queue_index)|| - (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index]))||\ - (priv->ieee80211->queue_stop) ) { - RT_TRACE(COMP_FIRMWARE,"===================NULL packet==================================> tx full!\n"); + if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) || + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index])) ||\ + (priv->ieee80211->queue_stop)) { + RT_TRACE(COMP_FIRMWARE, "===================NULL packet==================================> tx full!\n"); skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); } else { - priv->ieee80211->softmac_hard_start_xmit(skb,dev); + priv->ieee80211->softmac_hard_start_xmit(skb, dev); } return rtStatus; @@ -95,11 +90,9 @@ SendTxCommandPacket( * 05/06/2008 amy porting from windows code. * *---------------------------------------------------------------------------*/ - extern rt_status cmpk_message_handle_tx( - struct net_device *dev, - u8 *codevirtualaddress, - u32 packettype, - u32 buffer_len) +extern rt_status cmpk_message_handle_tx(struct net_device *dev, + u8 *codevirtualaddress, + u32 packettype, u32 buffer_len) { bool rt_status = true; @@ -121,7 +114,7 @@ SendTxCommandPacket( frag_threshold = pfirmware->cmdpacket_frag_thresold; do { if ((buffer_len - frag_offset) > frag_threshold) { - frag_length = frag_threshold ; + frag_length = frag_threshold; bLastIniPkt = 0; } else { @@ -138,7 +131,7 @@ SendTxCommandPacket( #else skb = dev_alloc_skb(frag_length + 4); #endif - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = packettype; @@ -153,23 +146,23 @@ SendTxCommandPacket( * Transform from little endian to big endian * and pending zero */ - memcpy(seg_ptr,codevirtualaddress,buffer_len); - tcb_desc->txbuf_size= (u16)buffer_len; + memcpy(seg_ptr, codevirtualaddress, buffer_len); + tcb_desc->txbuf_size = (u16)buffer_len; - if (!priv->ieee80211->check_nic_enough_desc(dev,tcb_desc->queue_index)|| - (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index]))||\ - (priv->ieee80211->queue_stop) ) { - RT_TRACE(COMP_FIRMWARE,"=====================================================> tx full!\n"); + if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) || + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index])) ||\ + (priv->ieee80211->queue_stop)) { + RT_TRACE(COMP_FIRMWARE, "=====================================================> tx full!\n"); skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); } else { - priv->ieee80211->softmac_hard_start_xmit(skb,dev); + priv->ieee80211->softmac_hard_start_xmit(skb, dev); } codevirtualaddress += frag_length; frag_offset += frag_length; - }while(frag_offset < buffer_len); + } while (frag_offset < buffer_len); return rt_status; @@ -194,10 +187,7 @@ SendTxCommandPacket( * 05/12/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -static void -cmpk_count_txstatistic( - struct net_device *dev, - cmpk_txfb_t *pstx_fb) +static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb) { struct r8192_priv *priv = ieee80211_priv(dev); #ifdef ENABLE_PS @@ -278,10 +268,7 @@ cmpk_count_txstatistic( * 05/08/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -static void -cmpk_handle_tx_feedback( - struct net_device *dev, - u8 *pmsg) +static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg) { struct r8192_priv *priv = ieee80211_priv(dev); cmpk_txfb_t rx_tx_fb; /* */ @@ -303,27 +290,24 @@ cmpk_handle_tx_feedback( } /* cmpk_Handle_Tx_Feedback */ -void -cmdpkt_beacontimerinterrupt_819xusb( - struct net_device *dev -) +void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); u16 tx_rate; // // 070117, rcnjko: 87B have to S/W beacon for DTM encryption_cmn. // - if (priv->ieee80211->current_network.mode == IEEE_A || + if (priv->ieee80211->current_network.mode == IEEE_A || priv->ieee80211->current_network.mode == IEEE_N_5G || - (priv->ieee80211->current_network.mode == IEEE_N_24G && (!priv->ieee80211->pHTInfo->bCurSuppCCK))) { + (priv->ieee80211->current_network.mode == IEEE_N_24G && (!priv->ieee80211->pHTInfo->bCurSuppCCK))) { tx_rate = 60; DMESG("send beacon frame tx rate is 6Mbpm\n"); } else { - tx_rate =10; + tx_rate = 10; DMESG("send beacon frame tx rate is 1Mbpm\n"); } - rtl819xusb_beacon_tx(dev,tx_rate); // HW Beacon + rtl819xusb_beacon_tx(dev, tx_rate); // HW Beacon } @@ -351,10 +335,7 @@ cmdpkt_beacontimerinterrupt_819xusb( * 05/12/2008 amy Add this for rtl8192 porting from windows code. * *---------------------------------------------------------------------------*/ -static void -cmpk_handle_interrupt_status( - struct net_device *dev, - u8 *pmsg) +static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) { cmpk_intr_sta_t rx_intr_status; /* */ struct r8192_priv *priv = ieee80211_priv(dev); @@ -373,7 +354,7 @@ cmpk_handle_interrupt_status( // Statistics of beacon for ad-hoc mode. - if ( priv->ieee80211->iw_mode == IW_MODE_ADHOC) { + if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) { //2 maybe need endian transform? rx_intr_status.interrupt_status = *((u32 *)(pmsg + 4)); @@ -419,10 +400,7 @@ cmpk_handle_interrupt_status( * 05/12/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -static void -cmpk_handle_query_config_rx( - struct net_device *dev, - u8 *pmsg) +static void cmpk_handle_query_config_rx(struct net_device *dev, u8 *pmsg) { cmpk_query_cfg_t rx_query_cfg; /* */ @@ -431,15 +409,15 @@ cmpk_handle_query_config_rx( /* It seems that FW use big endian(MIPS) and DRV use little endian in windows OS. So we have to read the content byte by byte or transfer endian type before copy the message copy. */ - rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31; + rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000) >> 31; rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5; rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3; rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0; - rx_query_cfg.cfg_offset = pmsg[7]; - rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) | - (pmsg[10] << 8) | (pmsg[11] << 0); - rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | - (pmsg[14] << 8) | (pmsg[15] << 0); + rx_query_cfg.cfg_offset = pmsg[7]; + rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) | + (pmsg[10] << 8) | (pmsg[11] << 0); + rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | + (pmsg[14] << 8) | (pmsg[15] << 0); } /* cmpk_Handle_Query_Config_Rx */ @@ -461,8 +439,8 @@ cmpk_handle_query_config_rx( * 05/12/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -static void cmpk_count_tx_status( struct net_device *dev, - cmpk_tx_status_t *pstx_status) +static void cmpk_count_tx_status(struct net_device *dev, + cmpk_tx_status_t *pstx_status) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -485,12 +463,12 @@ static void cmpk_count_tx_status( struct net_device *dev, priv->stats.txfeedbackfail += pstx_status->txfail; priv->stats.txerrtotal += pstx_status->txfail; - priv->stats.txretrycount += pstx_status->txretry; + priv->stats.txretrycount += pstx_status->txretry; priv->stats.txfeedbackretry += pstx_status->txretry; - priv->stats.txmulticast += pstx_status->txmcok; - priv->stats.txbroadcast += pstx_status->txbcok; + priv->stats.txmulticast += pstx_status->txmcok; + priv->stats.txbroadcast += pstx_status->txbcok; priv->stats.txunicast += pstx_status->txucok; priv->stats.txerrmulticast += pstx_status->txmcfail; @@ -499,9 +477,9 @@ static void cmpk_count_tx_status( struct net_device *dev, priv->stats.txbytesmulticast += pstx_status->txmclength; priv->stats.txbytesbroadcast += pstx_status->txbclength; - priv->stats.txbytesunicast += pstx_status->txuclength; + priv->stats.txbytesunicast += pstx_status->txuclength; - priv->stats.last_packet_rate = pstx_status->rate; + priv->stats.last_packet_rate = pstx_status->rate; } /* cmpk_CountTxStatus */ @@ -523,10 +501,7 @@ static void cmpk_count_tx_status( struct net_device *dev, * 05/12/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -static void -cmpk_handle_tx_status( - struct net_device *dev, - u8 *pmsg) +static void cmpk_handle_tx_status(struct net_device *dev, u8 *pmsg) { cmpk_tx_status_t rx_tx_sts; /* */ @@ -553,15 +528,12 @@ cmpk_handle_tx_status( * 05/12/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -static void -cmpk_handle_tx_rate_history( - struct net_device *dev, - u8 *pmsg) +static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) { cmpk_tx_rahis_t *ptxrate; - u8 i, j; - u16 length = sizeof(cmpk_tx_rahis_t); - u32 *ptemp; + u8 i, j; + u16 length = sizeof(cmpk_tx_rahis_t); + u32 *ptemp; struct r8192_priv *priv = ieee80211_priv(dev); @@ -584,14 +556,14 @@ cmpk_handle_tx_rate_history( for (i = 0; i < (length/4); i++) { u16 temp1, temp2; - temp1 = ptemp[i]&0x0000FFFF; - temp2 = ptemp[i]>>16; - ptemp[i] = (temp1<<16)|temp2; + temp1 = ptemp[i] & 0x0000FFFF; + temp2 = ptemp[i] >> 16; + ptemp[i] = (temp1 << 16) | temp2; } ptxrate = (cmpk_tx_rahis_t *)pmsg; - if (ptxrate == NULL ) + if (ptxrate == NULL) return; for (i = 0; i < 16; i++) { @@ -600,7 +572,7 @@ cmpk_handle_tx_rate_history( priv->stats.txrate.cck[i] += ptxrate->cck[i]; // Collect OFDM rate packet num - if (i< 8) + if (i < 8) priv->stats.txrate.ofdm[i] += ptxrate->ofdm[i]; for (j = 0; j < 4; j++) @@ -630,10 +602,8 @@ cmpk_handle_tx_rate_history( * 05/06/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -extern u32 -cmpk_message_handle_rx( - struct net_device *dev, - struct ieee80211_rx_stats *pstats) +extern u32 cmpk_message_handle_rx(struct net_device *dev, + struct ieee80211_rx_stats *pstats) { int total_length; u8 cmd_length, exe_cnt = 0; @@ -642,7 +612,7 @@ cmpk_message_handle_rx( /* 0. Check inpt arguments. If is is a command queue message or pointer is null. */ - if (pstats== NULL) + if (pstats == NULL) return 0; /* This is not a command packet. */ /* 1. Read received command packet message length from RFD. */ @@ -664,7 +634,7 @@ cmpk_message_handle_rx( switch (element_id) { case RX_TX_FEEDBACK: - cmpk_handle_tx_feedback (dev, pcmd_buff); + cmpk_handle_tx_feedback(dev, pcmd_buff); cmd_length = CMPK_RX_TX_FB_SIZE; break;