From c5779a0d1feff5d4e16f3bd4b1b17a41aac51d8a Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 9 May 2014 15:03:58 +0200 Subject: [PATCH] staging: rtl8723au: rtw_free_recvframe23a() is always passed precvpriv->free_recv_queue No point in passing in the pointer to free_recv_queue, when we always pass in the same value. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_recv.c | 56 ++++++++----------- drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 3 +- drivers/staging/rtl8723au/hal/usb_ops_linux.c | 10 ++-- drivers/staging/rtl8723au/include/rtw_recv.h | 3 +- drivers/staging/rtl8723au/os_dep/recv_linux.c | 8 +-- 5 files changed, 31 insertions(+), 49 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 756ad3f0ebd5..131b98c0582b 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -133,18 +133,18 @@ struct recv_frame *rtw_alloc_recvframe23a(struct rtw_queue *pfree_recv_queue) return pframe; } -int rtw_free_recvframe23a(struct recv_frame *precvframe, struct rtw_queue *pfree_recv_queue) +int rtw_free_recvframe23a(struct recv_frame *precvframe) { struct rtw_adapter *padapter = precvframe->adapter; struct recv_priv *precvpriv = &padapter->recvpriv; - - + struct rtw_queue *pfree_recv_queue; if (precvframe->pkt) { dev_kfree_skb_any(precvframe->pkt);/* free skb by driver */ precvframe->pkt = NULL; } + pfree_recv_queue = &precvpriv->free_recv_queue; spin_lock_bh(&pfree_recv_queue->lock); list_del_init(&precvframe->list); @@ -192,12 +192,11 @@ using spinlock to protect */ -void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue, struct rtw_queue *pfree_recv_queue) +static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue) { struct recv_frame *hdr; struct list_head *plist, *phead, *ptmp; - spin_lock(&pframequeue->lock); phead = get_list_head(pframequeue); @@ -205,12 +204,10 @@ void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue, struct rtw_queu list_for_each_safe(plist, ptmp, phead) { hdr = container_of(plist, struct recv_frame, list); - rtw_free_recvframe23a(hdr, pfree_recv_queue); + rtw_free_recvframe23a(hdr); } spin_unlock(&pframequeue->lock); - - } u32 rtw_free_uc_swdec_pending_queue23a(struct rtw_adapter *adapter) @@ -218,8 +215,7 @@ u32 rtw_free_uc_swdec_pending_queue23a(struct rtw_adapter *adapter) u32 cnt = 0; struct recv_frame *pending_frame; while ((pending_frame = rtw_alloc_recvframe23a(&adapter->recvpriv.uc_swdec_pending_queue))) { - rtw_free_recvframe23a(pending_frame, - &adapter->recvpriv.free_recv_queue); + rtw_free_recvframe23a(pending_frame); DBG_8723A("%s: dequeue uc_swdec_pending_queue\n", __func__); cnt++; } @@ -532,8 +528,7 @@ struct recv_frame *decryptor(struct rtw_adapter *padapter, } if (res == _FAIL) { - rtw_free_recvframe23a(return_packet, - &padapter->recvpriv.free_recv_queue); + rtw_free_recvframe23a(return_packet); return_packet = NULL; } @@ -586,8 +581,7 @@ static struct recv_frame *portctrl(struct rtw_adapter *adapter, prtnframe = precv_frame; } else { /* free this frame */ - rtw_free_recvframe23a(precv_frame, - &adapter->recvpriv.free_recv_queue); + rtw_free_recvframe23a(precv_frame); prtnframe = NULL; } } else { @@ -1653,8 +1647,8 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, if (curfragnum != prframe->attrib.frag_num) { /* the first fragment number must be 0 */ /* free the whole queue */ - rtw_free_recvframe23a(prframe, pfree_recv_queue); - rtw_free_recvframe23a_queue(defrag_q, pfree_recv_queue); + rtw_free_recvframe23a(prframe); + rtw_free_recvframe23a_queue(defrag_q); return NULL; } @@ -1674,8 +1668,8 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, /* the fragment number must be increasing (after decache) */ /* release the defrag_q & prframe */ - rtw_free_recvframe23a(prframe, pfree_recv_queue); - rtw_free_recvframe23a_queue(defrag_q, pfree_recv_queue); + rtw_free_recvframe23a(prframe); + rtw_free_recvframe23a_queue(defrag_q); return NULL; } @@ -1703,7 +1697,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, }; /* free the defrag_q queue and return the prframe */ - rtw_free_recvframe23a_queue(defrag_q, pfree_recv_queue); + rtw_free_recvframe23a_queue(defrag_q); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("Performance defrag!!!!!\n")); @@ -1764,7 +1758,7 @@ struct recv_frame* recvframe_chk_defrag23a(struct rtw_adapter *padapter, /* the first fragment */ if (_rtw_queue_empty23a(pdefrag_q) == false) { /* free current defrag_q */ - rtw_free_recvframe23a_queue(pdefrag_q, pfree_recv_queue); + rtw_free_recvframe23a_queue(pdefrag_q); } } @@ -1785,7 +1779,7 @@ struct recv_frame* recvframe_chk_defrag23a(struct rtw_adapter *padapter, } else { /* can't find this ta's defrag_queue, so free this recv_frame */ - rtw_free_recvframe23a(precv_frame, pfree_recv_queue); + rtw_free_recvframe23a(precv_frame); prtnframe = NULL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("Free because pdefrag_q == NULL: ismfrag = " @@ -1811,7 +1805,7 @@ struct recv_frame* recvframe_chk_defrag23a(struct rtw_adapter *padapter, } else { /* can't find this ta's defrag_queue, so free this recv_frame */ - rtw_free_recvframe23a(precv_frame, pfree_recv_queue); + rtw_free_recvframe23a(precv_frame); prtnframe = NULL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("Free because pdefrag_q == NULL: ismfrag = " @@ -1826,7 +1820,7 @@ struct recv_frame* recvframe_chk_defrag23a(struct rtw_adapter *padapter, RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chkmic(padapter, prtnframe) ==" "_FAIL\n")); - rtw_free_recvframe23a(prtnframe, pfree_recv_queue); + rtw_free_recvframe23a(prtnframe); prtnframe = NULL; } } @@ -1842,8 +1836,6 @@ int amsdu_to_msdu(struct rtw_adapter *padapter, struct recv_frame *prframe) struct rx_pkt_attrib *pattrib; struct sk_buff *skb, *sub_skb; struct sk_buff_head skb_list; - struct recv_priv *precvpriv = &padapter->recvpriv; - struct rtw_queue *pfree_recv_queue = &precvpriv->free_recv_queue; pattrib = &prframe->attrib; @@ -1865,7 +1857,7 @@ int amsdu_to_msdu(struct rtw_adapter *padapter, struct recv_frame *prframe) } prframe->pkt = NULL; - rtw_free_recvframe23a(prframe, pfree_recv_queue); + rtw_free_recvframe23a(prframe); return _SUCCESS; } @@ -2020,10 +2012,8 @@ int recv_indicatepkts_in_order(struct rtw_adapter *padapter, } } else { if (amsdu_to_msdu(padapter, prframe) != - _SUCCESS) { - rtw_free_recvframe23a(prframe, - &precvpriv->free_recv_queue); - } + _SUCCESS) + rtw_free_recvframe23a(prframe); } /* Update local variables. */ @@ -2228,7 +2218,6 @@ int process_recv_indicatepkts(struct rtw_adapter *padapter, static int recv_func_prehandle(struct rtw_adapter *padapter, struct recv_frame *rframe) { - struct rtw_queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; int ret = _SUCCESS; /* check the frame crtl field and decache */ @@ -2236,7 +2225,7 @@ static int recv_func_prehandle(struct rtw_adapter *padapter, if (ret != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("recv_func: validate_recv_frame fail! drop pkt\n")); - rtw_free_recvframe23a(rframe, pfree_recv_queue); + rtw_free_recvframe23a(rframe); goto exit; } @@ -2250,7 +2239,6 @@ static int recv_func_posthandle(struct rtw_adapter *padapter, int ret = _SUCCESS; struct recv_frame *orig_prframe = prframe; struct recv_priv *precvpriv = &padapter->recvpriv; - struct rtw_queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; /* DATA FRAME */ rtw_led_control(padapter, LED_CTL_RX); @@ -2296,7 +2284,7 @@ static int recv_func_posthandle(struct rtw_adapter *padapter, if (ret != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recv_func: process_recv_indicatepkts fail!\n")); - rtw_free_recvframe23a(orig_prframe, pfree_recv_queue);/* free this recv_frame */ + rtw_free_recvframe23a(orig_prframe);/* free this recv_frame */ goto _recv_data_drop; } return ret; diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c index 068ad35e46df..403dc8e07e73 100644 --- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c @@ -255,7 +255,6 @@ u32 rtw_free_stainfo23a(struct rtw_adapter *padapter, struct sta_info *psta) struct list_head *phead, *plist; struct recv_frame *prframe; struct rtw_queue *ppending_recvframe_queue; - struct rtw_queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; preorder_ctrl = &psta->recvreorder_ctrl[i]; @@ -271,7 +270,7 @@ u32 rtw_free_stainfo23a(struct rtw_adapter *padapter, struct sta_info *psta) prframe = container_of(plist, struct recv_frame, list); plist = plist->next; list_del_init(&prframe->list); - rtw_free_recvframe23a(prframe, pfree_recv_queue); + rtw_free_recvframe23a(prframe); } spin_unlock_bh(&ppending_recvframe_queue->lock); } diff --git a/drivers/staging/rtl8723au/hal/usb_ops_linux.c b/drivers/staging/rtl8723au/hal/usb_ops_linux.c index 870fe5dabce4..3aa0374cb60a 100644 --- a/drivers/staging/rtl8723au/hal/usb_ops_linux.c +++ b/drivers/staging/rtl8723au/hal/usb_ops_linux.c @@ -513,7 +513,7 @@ static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb) if (pattrib->crc_err) { DBG_8723A("%s()-%d: RX Warning! rx CRC ERROR !!\n", __FUNCTION__, __LINE__); - rtw_free_recvframe23a(precvframe, pfree_recv_queue); + rtw_free_recvframe23a(precvframe); goto _exit_recvbuf2recvframe; } @@ -525,7 +525,7 @@ static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb) ("recvbuf2recvframe: pkt_len<= 0\n")); DBG_8723A("%s()-%d: RX Warning!\n", __FUNCTION__, __LINE__); - rtw_free_recvframe23a(precvframe, pfree_recv_queue); + rtw_free_recvframe23a(precvframe); goto _exit_recvbuf2recvframe; } @@ -570,8 +570,7 @@ static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb) if ((pattrib->mfrag == 1) && (pattrib->frag_num == 0)) { DBG_8723A("recvbuf2recvframe: alloc_skb fail, " "drop frag frame \n"); - rtw_free_recvframe23a(precvframe, - pfree_recv_queue); + rtw_free_recvframe23a(precvframe); goto _exit_recvbuf2recvframe; } @@ -579,8 +578,7 @@ static int recvbuf2recvframe(struct rtw_adapter *padapter, struct sk_buff *pskb) if (!precvframe->pkt) { DBG_8723A("recvbuf2recvframe: skb_clone " "fail\n"); - rtw_free_recvframe23a(precvframe, - pfree_recv_queue); + rtw_free_recvframe23a(precvframe); goto _exit_recvbuf2recvframe; } } diff --git a/drivers/staging/rtl8723au/include/rtw_recv.h b/drivers/staging/rtl8723au/include/rtw_recv.h index 35e47dac8615..3bd836fc74d8 100644 --- a/drivers/staging/rtl8723au/include/rtw_recv.h +++ b/drivers/staging/rtl8723au/include/rtw_recv.h @@ -279,11 +279,10 @@ struct recv_frame { /* get a free recv_frame from pfree_recv_queue */ struct recv_frame *rtw_alloc_recvframe23a(struct rtw_queue *pfree_recv_queue); -int rtw_free_recvframe23a(struct recv_frame *precvframe, struct rtw_queue *pfree_recv_queue); +int rtw_free_recvframe23a(struct recv_frame *precvframe); int rtw_enqueue_recvframe23a(struct recv_frame *precvframe, struct rtw_queue *queue); -void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue, struct rtw_queue *pfree_recv_queue); u32 rtw_free_uc_swdec_pending_queue23a(struct rtw_adapter *adapter); int rtw_enqueue_recvbuf23a_to_head(struct recv_buf *precvbuf, struct rtw_queue *queue); diff --git a/drivers/staging/rtl8723au/os_dep/recv_linux.c b/drivers/staging/rtl8723au/os_dep/recv_linux.c index 528ed9253b14..bcd970baf405 100644 --- a/drivers/staging/rtl8723au/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723au/os_dep/recv_linux.c @@ -73,12 +73,10 @@ int rtw_recv_indicatepkt23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) { struct recv_priv *precvpriv; - struct rtw_queue *pfree_recv_queue; struct sk_buff *skb; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - precvpriv = &(padapter->recvpriv); - pfree_recv_queue = &(precvpriv->free_recv_queue); + precvpriv = &padapter->recvpriv; skb = precv_frame->pkt; if (!skb) { @@ -147,7 +145,7 @@ _recv_indicatepkt_end: precv_frame->pkt = NULL; /* pointers to NULL before rtw_free_recvframe23a() */ - rtw_free_recvframe23a(precv_frame, pfree_recv_queue); + rtw_free_recvframe23a(precv_frame); RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("\n rtw_recv_indicatepkt23a :after netif_rx!!!!\n")); @@ -155,7 +153,7 @@ _recv_indicatepkt_end: _recv_indicatepkt_drop: - rtw_free_recvframe23a(precv_frame, pfree_recv_queue); + rtw_free_recvframe23a(precv_frame); return _FAIL; } -- 2.20.1