staging: r8188eu: we use a constant number of hw_xmit entries
authorMartin Kaiser <martin@kaiser.cx>
Mon, 23 Jan 2023 20:53:20 +0000 (21:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jan 2023 09:10:35 +0000 (10:10 +0100)
struct xmit_priv contains a pointer to an array of struct hw_xmit entries.
xmit_priv's (ill-named) hwxmit_entry component stores the size of this
array, i.e. the number of hw_xmit entries that are used.

The array size is constant, it's initialised to HWXMIT_ENTRY and never
updated. Simplify the code accordingly. Remove hwxmit_entry, do not pass
the array size as a function parameter and use HWXMIT_ENTRY in the code
that handles the array.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Link: https://lore.kernel.org/r/20230123205342.229589-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_xmit.c
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
drivers/staging/r8188eu/include/rtw_xmit.h

index c51f6ea..5f2426b 100644 (file)
@@ -1375,7 +1375,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str
        return pxmitframe;
 }
 
-struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, int entry)
+struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i)
 {
        struct list_head *sta_plist, *sta_phead;
        struct hw_xmit *phwxmit;
@@ -1397,7 +1397,7 @@ struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi
 
        spin_lock_bh(&pxmitpriv->lock);
 
-       for (i = 0; i < entry; i++) {
+       for (i = 0; i < HWXMIT_ENTRY; i++) {
                phwxmit = phwxmit_i + inx[i];
 
                sta_phead = get_list_head(phwxmit->sta_queue);
@@ -1501,9 +1501,7 @@ int rtw_alloc_hwxmits(struct adapter *padapter)
        struct hw_xmit *hwxmits;
        struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
 
-       pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
-
-       pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, sizeof(struct hw_xmit), GFP_KERNEL);
+       pxmitpriv->hwxmits = kcalloc(HWXMIT_ENTRY, sizeof(struct hw_xmit), GFP_KERNEL);
        if (!pxmitpriv->hwxmits)
                return -ENOMEM;
 
index d1af76c..e097fa1 100644 (file)
@@ -398,7 +398,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit
        if (!pxmitbuf)
                return false;
 
-       pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
+       pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits);
        if (!pxmitframe) {
                /*  no more xmit frame, release xmit buffer */
                rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
index 883eacd..cc32167 100644 (file)
@@ -273,7 +273,6 @@ struct      xmit_priv {
        u64     last_tx_bytes;
        u64     last_tx_pkts;
        struct hw_xmit *hwxmits;
-       u8      hwxmit_entry;
        u8      wmm_para_seq[4];/* sequence for wmm ac parameter strength
                                 * from large to small. it's value is 0->vo,
                                 * 1->vi, 2->be, 3->bk. */
@@ -324,7 +323,7 @@ struct tx_servq *rtw_get_sta_pending(struct adapter *padapter,
 s32 rtw_xmitframe_enqueue(struct adapter *padapter,
                          struct xmit_frame *pxmitframe);
 struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv,
-                                     struct hw_xmit *phwxmit_i, int entry);
+                                     struct hw_xmit *phwxmit_i);
 
 s32 rtw_xmit_classifier(struct adapter *padapter,
                        struct xmit_frame *pxmitframe);