Re: [PATCH v2 5/8] staging: r8188eu: remove HW_VAR_RXDMA_AGG_PG_TH from SetHwReg8188EU()

Greg KH
2022-03-31T05:52:35Z

On Tue, Mar 29, 2022 at 10:21:38PM +0200, Michael Straube wrote:
> 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>
> ---
> v2: Moved the code into a function and included patch 6/9 of v1.
>
> drivers/staging/r8188eu/core/rtw_mlme.c | 34 +++++++++++++---------
> drivers/staging/r8188eu/hal/usb_halinit.c | 8 -----
> drivers/staging/r8188eu/include/hal_intf.h | 1 -
> 3 files changed, 21 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
> index f1e1627641cb..086d64542082 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme.c
> @@ -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);
> + }
> +}

For future cleanups, this function can be made a lot smaller :)

thanks,

greg k-h