All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Briana Oursler <briana.oursler@gmail.com>
Cc: forest@alittletooquiet.net, outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy} [PATCH] Staging: vt6655: Refactor switch case statement.
Date: Wed, 25 Mar 2020 13:35:45 +0100	[thread overview]
Message-ID: <20200325123545.GB3430583@kroah.com> (raw)
In-Reply-To: <20200325045500.88046-1-briana.oursler@gmail.com>

On Tue, Mar 24, 2020 at 09:55:00PM -0700, Briana Oursler wrote:
> Replaces nested if-else within switch case with ternary logic and variable
> setting to limit returns. Exposes primary logic to aid
> readability.

Wrap your changelog at the same size for each line, don't make it up :)

> 
> Signed-off-by: Briana Oursler <briana.oursler@gmail.com>
> ---
>  drivers/staging/vt6655/rxtx.c | 101 +++++++++++++---------------------
>  1 file changed, 39 insertions(+), 62 deletions(-)

Where did the "}" character come from on the subject line?


> 
> diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
> index 37fcc42ed000..eb7b20286ae2 100644
> --- a/drivers/staging/vt6655/rxtx.c
> +++ b/drivers/staging/vt6655/rxtx.c
> @@ -240,6 +240,7 @@ s_uGetDataDuration(
>  {
>  	bool bLastFrag = false;
>  	unsigned int uAckTime = 0, uNextPktTime = 0;
> +	unsigned int len;
>  
>  	if (uFragIdx == (uMACfragNum - 1))
>  		bLastFrag = true;
> @@ -254,17 +255,18 @@ s_uGetDataDuration(
>  				return 0;
>  			}
>  		} else {/* First Frag or Mid Frag */
> -			if (uFragIdx == (uMACfragNum - 2))
> -				uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
> -			else
> -				uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
> +			len = (uMacfragNum - 2 == uFragIdx) ?
> +				cbLastFragmentSize : cbFrameLength;

Ugh, I hate ? : logic.

Spell it out, be specific, this is just much harder to read now than
before.

> +			uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len, wRate, bNeedAck);
>  
>  			if (bNeedAck) {
> -				uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
> -				return pDevice->uSIFS + uAckTime + uNextPktTime;
> +				uAckTime = BBuGetFrameTime(pDevice->byPreambleType,
> +							   byPktType, 14, pDevice->byTopCCKBasicRate);

You didn't wrap this properly?


>  			} else {
> -				return pDevice->uSIFS + uNextPktTime;
> +				uAckTime = 0;
>  			}
> +
> +			return pDevice->uSIFS + uAckTime + uNextPktTime;
>  		}
>  		break;
>  
> @@ -277,17 +279,18 @@ s_uGetDataDuration(
>  				return 0;
>  			}
>  		} else {/* First Frag or Mid Frag */
> -			if (uFragIdx == (uMACfragNum - 2))
> -				uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
> -			else
> -				uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
> +			len = (uMacfragNum - 2 == uFragIdx) ?
> +				cbLastFragmentSize : cbFrameLength;

Same here, this makes it harder to understand.

thanks,

greg k-h


  reply	other threads:[~2020-03-25 12:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25  4:55 [Outreachy} [PATCH] Staging: vt6655: Refactor switch case statement Briana Oursler
2020-03-25 12:35 ` Greg KH [this message]
2020-03-25 17:46   ` [Outreachy] " Briana Oursler
2020-03-25 17:48   ` Briana Oursler
2020-03-25 18:01   ` Briana Oursler
2020-03-25 19:34     ` Briana Oursler
2020-03-27  0:33   ` [PATCH v2] " Briana Oursler
2020-03-27  1:14     ` [Outreachy kernel] " Lakshmi Ramasubramanian
2020-03-27  2:53       ` [Outreachy][PATCH v3] " Briana Oursler
2020-03-27  9:00         ` Greg KH
2020-03-27 21:32           ` [Outreachy][Patch v4] " Briana Oursler
2020-03-27 21:40             ` [Outreachy kernel] " Julia Lawall
2020-03-28  5:10               ` [patch v5] Staging: vt6655: Reduce statement complexity Briana Oursler
2020-03-28 10:19                 ` Julia Lawall
2020-03-29  1:05                   ` Briana Oursler

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=20200325123545.GB3430583@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=briana.oursler@gmail.com \
    --cc=forest@alittletooquiet.net \
    --cc=outreachy-kernel@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.