staging: r8188eu: merge rtw_os_recvbuf_resource_alloc() into rtw_recv.c
authorMichael Straube <straube.linux@gmail.com>
Sun, 7 Aug 2022 18:15:35 +0000 (20:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2022 13:19:05 +0000 (15:19 +0200)
Merge the functionality of the function rtw_os_recvbuf_resource_alloc()
into rtl8188eu_init_recv_priv(). Merging the functionality instead of
just making the function static improves readability and we have one
function less to care about when converting the uses of _FAIL/_SUCCESS
to normal kernel error code logic.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220807181538.8499-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_recv.c
drivers/staging/r8188eu/include/recv_osdep.h
drivers/staging/r8188eu/os_dep/recv_linux.c

index 7a97c090f2972e9d327ddf8598a406b2a6465e34..5de4e13b4b17fd4be84ea1f3a145bddd684acfcd 100644 (file)
@@ -62,9 +62,13 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter)
        precvbuf = (struct recv_buf *)precvpriv->precv_buf;
 
        for (i = 0; i < NR_RECVBUFF; i++) {
-               res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf);
-               if (res == _FAIL)
+               precvbuf->pskb = NULL;
+               precvbuf->reuse = false;
+               precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
+               if (!precvbuf->purb) {
+                       res = _FAIL;
                        break;
+               }
                precvbuf->adapter = padapter;
                precvbuf++;
        }
index b9dc32c20cfd7502e46c39170b142a1c2a249002..51dc287f263c0e7a4babe5dc65565a0c9ad9e85b 100644 (file)
@@ -19,8 +19,6 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup);
 int rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter);
 void rtw_free_recv_priv(struct recv_priv *precvpriv);
 
-int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf);
-
 void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl);
 int _netdev_open(struct net_device *pnetdev);
 int netdev_open(struct net_device *pnetdev);
index abdb42ab649bee4f5ed618039a0669a36f9d1dcb..c180f0e4dd3cdadcf295750a107d4d53dba1bbb1 100644 (file)
 #include "../include/osdep_intf.h"
 #include "../include/usb_ops.h"
 
-/* alloc os related resource in struct recv_buf */
-int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
-               struct recv_buf *precvbuf)
-{
-       int res = _SUCCESS;
-
-       precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
-       if (!precvbuf->purb)
-               res = _FAIL;
-       precvbuf->pskb = NULL;
-       precvbuf->reuse = false;
-       return res;
-}
-
 void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)
 {
        union iwreq_data wrqu;