staging: r8188eu: remove HW_VAR_RXDMA_AGG_PG_TH from SetHwReg8188EU()
authorMichael Straube <straube.linux@gmail.com>
Tue, 29 Mar 2022 20:21:38 +0000 (22:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Apr 2022 05:33:47 +0000 (07:33 +0200)
The HW_VAR_RXDMA_AGG_PG_TH case in SetHwReg8188EU() just sets a
variable conditionally and then calls rtw_write8(). Set the variable
in the caller and call rtw_write8() directly. Move the functionality
into a new static function to make the code cleaner. Remove the
HW_VAR_RXDMA_AGG_PG_TH case from SetHwReg8188EU(). This is part of the
ongoing effort to get rid of the unwanted hal layer.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329202141.7028-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme.c
drivers/staging/r8188eu/hal/usb_halinit.c
drivers/staging/r8188eu/include/hal_intf.h

index f1e1627641cb6199a149d9d3af96ee68c99284e6..086d6454208254b170b1eb695632e6ea3b607608 100644 (file)
@@ -1787,10 +1787,29 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter)
 
 }
 
+static void rtw_set_threshold(struct adapter *adapter)
+{
+       u8 threshold;
+       struct mlme_priv *mlmepriv = &adapter->mlmepriv;
+       struct ht_priv *htpriv = &mlmepriv->htpriv;
+
+       /*  TH = 1 => means that invalidate usb rx aggregation */
+       /*  TH = 0 => means that validate usb rx aggregation, use init value. */
+       if (htpriv->ht_option) {
+               if (adapter->registrypriv.wifi_spec == 1)
+                       threshold = 1;
+               else
+                       threshold = USB_RXAGG_PAGE_COUNT;
+
+               rtw_write8(adapter, REG_RXDMA_AGG_PG_TH, threshold);
+       } else {
+               rtw_write8(adapter, REG_RXDMA_AGG_PG_TH, 1);
+       }
+}
+
 /* the function is at passive_level */
 void rtw_joinbss_reset(struct adapter *padapter)
 {
-       u8      threshold;
        struct mlme_priv        *pmlmepriv = &padapter->mlmepriv;
        struct ht_priv          *phtpriv = &pmlmepriv->htpriv;
 
@@ -1801,18 +1820,7 @@ void rtw_joinbss_reset(struct adapter *padapter)
 
        phtpriv->ampdu_enable = false;/* reset to disabled */
 
-       /*  TH = 1 => means that invalidate usb rx aggregation */
-       /*  TH = 0 => means that validate usb rx aggregation, use init value. */
-       if (phtpriv->ht_option) {
-               if (padapter->registrypriv.wifi_spec == 1)
-                       threshold = 1;
-               else
-                       threshold = 0;
-               SetHwReg8188EU(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
-       } else {
-               threshold = 1;
-               SetHwReg8188EU(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
-       }
+       rtw_set_threshold(padapter);
 }
 
 /* the function is >= passive_level */
index 1bf867123c48d6df2d503f10a006cab88c22da50..1b08346f2afd7b59092fbaef6bfde2dd6dcc7365 100644 (file)
@@ -1193,14 +1193,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
                        }
                }
                break;
-       case HW_VAR_RXDMA_AGG_PG_TH:
-               {
-                       u8 threshold = *((u8 *)val);
-                       if (threshold == 0)
-                               threshold = USB_RXAGG_PAGE_COUNT;
-                       rtw_write8(Adapter, REG_RXDMA_AGG_PG_TH, threshold);
-               }
-               break;
        case HW_VAR_H2C_FW_PWRMODE:
                {
                        u8 psmode = (*(u8 *)val);
index 5b4de29a2e109536ec972a6a8ac5302a0a541b54..8708675c347871e743a27c5288716d1b04ede18a 100644 (file)
@@ -25,7 +25,6 @@ enum hw_variables {
        HW_VAR_AC_PARAM_BE,
        HW_VAR_AMPDU_MIN_SPACE,
        HW_VAR_AMPDU_FACTOR,
-       HW_VAR_RXDMA_AGG_PG_TH,
        HW_VAR_H2C_FW_PWRMODE,
        HW_VAR_H2C_FW_JOINBSSRPT,
        HW_VAR_FWLPS_RF_ON,