From f466c400e78f785dee0b16b7198df0d4c601b162 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Tue, 15 Apr 2014 19:44:42 +0200 Subject: [PATCH] staging: rtl8723au: Fold some resource allocation abstraction into their callers Fold rtw_os_recvbuf_resource_alloc23a() and rtw_os_recvbuf_resource_free23a() into the functions calling them. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8723au/hal/rtl8723au_recv.c | 10 +++++-- .../staging/rtl8723au/include/recv_osdep.h | 3 -- drivers/staging/rtl8723au/os_dep/recv_linux.c | 29 ------------------- 3 files changed, 7 insertions(+), 35 deletions(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c index a7568bb65e2a..e1f17af78a12 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c @@ -65,8 +65,8 @@ int rtl8723au_init_recv_priv(struct rtw_adapter *padapter) for (i = 0; i < NR_RECVBUFF; i++) { INIT_LIST_HEAD(&precvbuf->list); - res = rtw_os_recvbuf_resource_alloc23a(padapter, precvbuf); - if (res == _FAIL) + precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); + if (!precvbuf->purb) break; precvbuf->adapter = padapter; @@ -109,7 +109,11 @@ void rtl8723au_free_recv_priv(struct rtw_adapter *padapter) precvbuf = (struct recv_buf *)precvpriv->precv_buf; for (i = 0; i < NR_RECVBUFF; i++) { - rtw_os_recvbuf_resource_free23a(padapter, precvbuf); + usb_free_urb(precvbuf->purb); + + if (precvbuf->pskb) + dev_kfree_skb_any(precvbuf->pskb); + precvbuf++; } diff --git a/drivers/staging/rtl8723au/include/recv_osdep.h b/drivers/staging/rtl8723au/include/recv_osdep.h index 39809befb88c..3a2cd8a3058d 100644 --- a/drivers/staging/rtl8723au/include/recv_osdep.h +++ b/drivers/staging/rtl8723au/include/recv_osdep.h @@ -33,9 +33,6 @@ void rtw_free_recv_priv (struct recv_priv *precvpriv); int rtw_os_recv_resource_init(struct recv_priv *precvpriv, struct rtw_adapter *padapter); -int rtw_os_recvbuf_resource_alloc23a(struct rtw_adapter *padapter, struct recv_buf *precvbuf); -int rtw_os_recvbuf_resource_free23a(struct rtw_adapter *padapter, struct recv_buf *precvbuf); - void rtw_init_recv_timer23a(struct recv_reorder_ctrl *preorder_ctrl); #endif diff --git a/drivers/staging/rtl8723au/os_dep/recv_linux.c b/drivers/staging/rtl8723au/os_dep/recv_linux.c index 321aa282e3f2..8fecbe38ca27 100644 --- a/drivers/staging/rtl8723au/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723au/os_dep/recv_linux.c @@ -24,35 +24,6 @@ #include -/* alloc os related resource in struct recv_buf */ -int rtw_os_recvbuf_resource_alloc23a(struct rtw_adapter *padapter, - struct recv_buf *precvbuf) -{ - int res = _SUCCESS; - - precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); - if (precvbuf->purb == NULL) - res = _FAIL; - - precvbuf->pskb = NULL; - - return res; -} - -/* free os related resource in struct recv_buf */ -int rtw_os_recvbuf_resource_free23a(struct rtw_adapter *padapter, - struct recv_buf *precvbuf) -{ - int ret = _SUCCESS; - - usb_free_urb(precvbuf->purb); - - if (precvbuf->pskb) - dev_kfree_skb_any(precvbuf->pskb); - - return ret; -} - void rtw_handle_tkip_mic_err23a(struct rtw_adapter *padapter, u8 bgroup) { enum nl80211_key_type key_type = 0; -- 2.30.2