From 49ab4b6c4f53bfb77720a1ab4dde880c838dbbcf Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sun, 11 Aug 2013 22:07:26 -0500 Subject: [PATCH] rtl8188eu: Fix checkpatch errors in os_dep/xmit_linux.c Signed-off-by: Larry Finger --- os_dep/xmit_linux.c | 98 ++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 60 deletions(-) diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index 1a45635..276561c 100644 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -33,18 +33,21 @@ uint rtw_remainder_len(struct pkt_file *pfile) { - return (pfile->buf_len - ((size_t)(pfile->cur_addr) - (size_t)(pfile->buf_start))); + return pfile->buf_len - ((size_t)(pfile->cur_addr) - + (size_t)(pfile->buf_start)); } -void _rtw_open_pktfile (struct sk_buff *pktptr, struct pkt_file *pfile) +void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile) { _func_enter_; pfile->pkt = pktptr; - pfile->cur_addr = pfile->buf_start = pktptr->data; - pfile->pkt_len = pfile->buf_len = pktptr->len; + pfile->cur_addr = pktptr->data; + pfile->buf_start = pktptr->data; + pfile->pkt_len = pktptr->len; + pfile->buf_len = pktptr->len; - pfile->cur_buffer = pfile->buf_start ; + pfile->cur_buffer = pfile->buf_start; _func_exit_; } @@ -55,14 +58,14 @@ uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen) _func_enter_; - len = rtw_remainder_len(pfile); - len = (rlen > len)? len: rlen; + len = rtw_remainder_len(pfile); + len = (rlen > len) ? len : rlen; - if (rmem) - skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, len); + if (rmem) + skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, len); - pfile->cur_addr += len; - pfile->pkt_len -= len; + pfile->cur_addr += len; + pfile->pkt_len -= len; _func_exit_; @@ -74,7 +77,7 @@ int rtw_endofpktfile(struct pkt_file *pfile) _func_enter_; if (pfile->pkt_len == 0) { -_func_exit_; + _func_exit_; return true; } @@ -87,7 +90,7 @@ void rtw_set_tx_chksum_offload(struct sk_buff *pkt, struct pkt_attrib *pattrib) { } -int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf,u32 alloc_sz) +int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz) { int i; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); @@ -95,14 +98,12 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz); if (pxmitbuf->pallocated_buf == NULL) - { return _FAIL; - } pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ); pxmitbuf->dma_transfer_addr = 0; - for (i=0; i<8; i++) { + for (i = 0; i < 8; i++) { pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); if (pxmitbuf->pxmit_urb[i] == NULL) { DBG_88E("pxmitbuf->pxmit_urb[i]==NULL"); @@ -112,21 +113,16 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb return _SUCCESS; } -void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitbuf,u32 free_sz) +void rtw_os_xmit_resource_free(struct adapter *padapter, + struct xmit_buf *pxmitbuf, u32 free_sz) { int i; struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); struct usb_device *pusbd = pdvobjpriv->pusbdev; - for (i=0; i<8; i++) - { - if (pxmitbuf->pxmit_urb[i]) - { - //usb_kill_urb(pxmitbuf->pxmit_urb[i]); - usb_free_urb(pxmitbuf->pxmit_urb[i]); - } - } + for (i = 0; i < 8; i++) + usb_free_urb(pxmitbuf->pxmit_urb[i]); if (pxmitbuf->pallocated_buf) rtw_mfree(pxmitbuf->pallocated_buf, free_sz); @@ -136,17 +132,15 @@ void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitb void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) u16 queue; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; queue = skb_get_queue_mapping(pkt); if (padapter->registrypriv.wifi_spec) { if (__netif_subqueue_stopped(padapter->pnetdev, queue) && - (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD)) - { + (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD)) netif_wake_subqueue(padapter->pnetdev, queue); - } } else { if (__netif_subqueue_stopped(padapter->pnetdev, queue)) netif_wake_subqueue(padapter->pnetdev, queue); @@ -162,14 +156,7 @@ void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt) void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe) { if (pxframe->pkt) - { - //RT_TRACE(_module_xmit_osdep_c_,_drv_err_,("linux : rtw_os_xmit_complete, dev_kfree_skb()\n")); - - //dev_kfree_skb_any(pxframe->pkt); rtw_os_pkt_complete(padapter, pxframe->pkt); - - } - pxframe->pkt = NULL; } @@ -196,25 +183,22 @@ void rtw_os_xmit_schedule(struct adapter *padapter) static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pkt) { struct xmit_priv *pxmitpriv = &padapter->xmitpriv; -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) u16 queue; queue = skb_get_queue_mapping(pkt); if (padapter->registrypriv.wifi_spec) { /* No free space for Tx, tx_worker is too slow */ - if (pxmitpriv->hwxmits[queue].accnt > WMM_XMIT_THRESHOLD) { - //DBG_88E("%s(): stop netif_subqueue[%d]\n", __func__, queue); + if (pxmitpriv->hwxmits[queue].accnt > WMM_XMIT_THRESHOLD) netif_stop_subqueue(padapter->pnetdev, queue); - } } else { - if (pxmitpriv->free_xmitframe_cnt<=4) { + if (pxmitpriv->free_xmitframe_cnt <= 4) { if (!netif_tx_queue_stopped(netdev_get_tx_queue(padapter->pnetdev, queue))) netif_stop_subqueue(padapter->pnetdev, queue); } } #else - if (pxmitpriv->free_xmitframe_cnt<=4) - { + if (pxmitpriv->free_xmitframe_cnt <= 4) { if (!rtw_netif_queue_stopped(padapter->pnetdev)) rtw_netif_stop_queue(padapter->pnetdev); } @@ -235,9 +219,8 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) phead = &pstapriv->asoc_list; plist = get_next(phead); - //free sta asoc_queue - while ((rtw_end_of_queue_search(phead, plist)) == false) - { + /* free sta asoc_queue */ + while (!rtw_end_of_queue_search(phead, plist)) { psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list); plist = get_next(plist); @@ -255,15 +238,15 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) DBG_88E("%s()-%d: rtw_xmit() return error!\n", __func__, __LINE__); pxmitpriv->tx_drop++; dev_kfree_skb_any(newskb); - } else + } else { pxmitpriv->tx_pkts++; + } } else { DBG_88E("%s-%d: skb_copy() failed!\n", __func__, __LINE__); pxmitpriv->tx_drop++; _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL); - //dev_kfree_skb_any(skb); - return false; // Caller shall tx this multicast frame via normal way. + return false; /* Caller shall tx this multicast frame via normal way. */ } } @@ -279,7 +262,7 @@ int rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; s32 res = 0; -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) u16 queue; #endif @@ -294,18 +277,13 @@ _func_enter_; rtw_check_xmit_resource(padapter, pkt); - if ( !rtw_mc2u_disable - && check_fwstate(pmlmepriv, WIFI_AP_STATE) == true - && ( IP_MCAST_MAC(pkt->data) - || ICMPV6_MCAST_MAC(pkt->data) ) - && (padapter->registrypriv.wifi_spec == 0) - ) - { - if ( pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4) ) { + if (!rtw_mc2u_disable && check_fwstate(pmlmepriv, WIFI_AP_STATE) && + (IP_MCAST_MAC(pkt->data) || ICMPV6_MCAST_MAC(pkt->data)) && + (padapter->registrypriv.wifi_spec == 0)) { + if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) { res = rtw_mlcst2unicst(padapter, pkt); - if (res == true) { + if (res) goto exit; - } } }