linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Michael Straube <straube.linux@gmail.com>
Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 6/8] staging: r8188eu: simplify if-else statement
Date: Thu, 31 Mar 2022 07:53:00 +0200	[thread overview]
Message-ID: <YkVBvF0trrcUFRUo@kroah.com> (raw)
In-Reply-To: <20220329202141.7028-7-straube.linux@gmail.com>

On Tue, Mar 29, 2022 at 10:21:39PM +0200, Michael Straube wrote:
> Simplify a nested if-else statement to a single if-else statement in
> rtw_set_threshold(). This improves readability and allows us to
> remove the local variable threshold.
> 
> Signed-off-by: Michael Straube <straube.linux@gmail.com>
> ---
> v2: Better readable simplification.
> 
>  drivers/staging/r8188eu/core/rtw_mlme.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
> index 086d64542082..1d52cfac1999 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme.c
> @@ -1789,20 +1789,14 @@ 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);
> +	if (htpriv->ht_option && adapter->registrypriv.wifi_spec != 1) {
> +		/* validate usb rx aggregation, use init value. */
> +		rtw_write8(adapter, REG_RXDMA_AGG_PG_TH, USB_RXAGG_PAGE_COUNT);
>  	} else {
> +		/* invalidate usb rx aggregation */
>  		rtw_write8(adapter, REG_RXDMA_AGG_PG_TH, 1);
>  	}
>  }
> -- 
> 2.35.1

Oh nevermind, you already cleaned it up, sorry for the noise :)

greg k-h

  reply	other threads:[~2022-03-31  5:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 20:21 [PATCH v2 0/8] staging: r8188eu: SetHwReg8188EU() cleanups Michael Straube
2022-03-29 20:21 ` [PATCH v2 1/8] staging: r8188eu: remove HW_VAR_RESP_SIFS from SetHwReg8188EU() Michael Straube
2022-03-29 20:21 ` [PATCH v2 2/8] staging: r8188eu: remove HW_VAR_MLME_DISCONNECT " Michael Straube
2022-03-29 20:21 ` [PATCH v2 3/8] staging: r8188eu: rename some macros to upper case Michael Straube
2022-03-29 20:21 ` [PATCH v2 4/8] staging: r8188eu: remove HW_VAR_ACM_CTRL from SetHwReg8188EU() Michael Straube
2022-03-29 20:21 ` [PATCH v2 5/8] staging: r8188eu: remove HW_VAR_RXDMA_AGG_PG_TH " Michael Straube
2022-03-31  5:52   ` Greg KH
2022-03-29 20:21 ` [PATCH v2 6/8] staging: r8188eu: simplify if-else statement Michael Straube
2022-03-31  5:53   ` Greg KH [this message]
2022-03-29 20:21 ` [PATCH v2 7/8] staging: r8188eu: remove HW_VAR_TX_RPT_MAX_MACID from SetHwReg8188EU() Michael Straube
2022-03-29 20:21 ` [PATCH v2 8/8] staging: r8188eu: remove HW_VAR_BCN_VALID " Michael Straube

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YkVBvF0trrcUFRUo@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).