From: Greg KH <gregkh@linuxfoundation.org>
To: Tanjuate Brunostar <tanjubrunostar0@gmail.com>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
outreachy@lists.linux.dev
Subject: Re: [PATCH v9 2/6] staging: vt6655: split long code lines in s_uGetRTSCTSDuration
Date: Sat, 29 Oct 2022 09:48:52 +0200 [thread overview]
Message-ID: <Y1za5Gzr/uXsPF3N@kroah.com> (raw)
In-Reply-To: <0e6a307052d3a354a850a502e509f46baccdbe1e.1666995639.git.tanjubrunostar0@gmail.com>
On Fri, Oct 28, 2022 at 11:23:23PM +0000, Tanjuate Brunostar wrote:
> Increase code visibility by splitting long lines of code in the
> function: s_uGetRTSCTSDuration
>
> Signed-off-by: Tanjuate Brunostar <tanjubrunostar0@gmail.com>
> ---
> drivers/staging/vt6655/rxtx.c | 108 ++++++++++++++++++++++++----------
> 1 file changed, 76 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
> index 7eb7c6eb5cf0..8e56a7ee8035 100644
> --- a/drivers/staging/vt6655/rxtx.c
> +++ b/drivers/staging/vt6655/rxtx.c
> @@ -186,20 +186,29 @@ static __le16 get_rtscts_time(struct vnt_private *priv,
>
> data_time = bb_get_frame_time(priv->preamble_type, pkt_type, frame_length, current_rate);
> if (rts_rsvtype == 0) { /* RTSTxRrvTime_bb */
> - rts_time = bb_get_frame_time(priv->preamble_type, pkt_type, 20, priv->byTopCCKBasicRate);
> - ack_time = bb_get_frame_time(priv->preamble_type, pkt_type, 14, priv->byTopCCKBasicRate);
> + rts_time = bb_get_frame_time(priv->preamble_type, pkt_type, 20,
> + priv->byTopCCKBasicRate);
> + ack_time = bb_get_frame_time(priv->preamble_type, pkt_type, 14,
> + priv->byTopCCKBasicRate);
While I understand the feeling of "let's fix this warning by wrapping
the line!" type of solution, overall, it's NOT the correct thing to do.
Remember, coding style changes are to be done to make code easier to
read and understand, not harder. The original code here is easier to
read, and you made it harder to understand.
The "best" solution for this will be to fix up the line length by virtue
of fixing up the incorrect variable names. Here is the original lines:
rts_time = bb_get_frame_time(priv->preamble_type, pkt_type, 20, priv->byTopCCKBasicRate);
ack_time = bb_get_frame_time(priv->preamble_type, pkt_type, 14, priv->byTopCCKBasicRate);
but if you were to fix up just 1 function and one variable name, look at
what happens and checkpatch is happy with it:
rts_time = get_frame_time(priv->preamble_type, pkt_type, 20, priv->top_basic_rate);
ack_time = get_frame_time(priv->preamble_type, pkt_type, 14, priv->top_basic_rate);
Or even better:
type = priv->preamble_type;
rate = priv->top_basic_rate;
rts_time = get_frame_time(type, pkt_type, 20, rate);
ack_time = get_frame_time(type, pkt_type, 14, rate);
Look, no line-wrapping and isn't that easier to understand? The second
version here might even produce smaller compiled code overall, making it
a even better solution.
So step back, revisit this whole series with the goal of overall making
the code better and easier to review. Don't create a series just with
the short-term goal of making checkpatch quiet.
Hope this helps,
greg k-h
next prev parent reply other threads:[~2022-10-29 7:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 23:23 [PATCH v9 0/6] Checkpatch cleanup in rxtx.c Tanjuate Brunostar
2022-10-28 23:23 ` [PATCH v9 1/6] staging: vt6655: fix lines ending in a '(' Tanjuate Brunostar
2022-10-28 23:23 ` [PATCH v9 2/6] staging: vt6655: split long code lines in s_uGetRTSCTSDuration Tanjuate Brunostar
2022-10-29 7:48 ` Greg KH [this message]
2022-10-29 19:20 ` Tanju Brunostar
2022-10-28 23:23 ` [PATCH v9 3/6] staging: vt6655: split long lines of code in s_uFillDataHead Tanjuate Brunostar
2022-10-28 23:23 ` [PATCH v9 4/6] staging: vt6655: split long lines of code in s_vGenerateTxParamete Tanjuate Brunostar
2022-10-28 23:23 ` [PATCH v9 5/6] staging: vt6655: split long lines of code in file Tanjuate Brunostar
2022-10-28 23:23 ` [PATCH v9 6/6] staging: vt6655: fix lines of code ending in a '(' Tanjuate Brunostar
2022-10-29 0:29 ` [PATCH v9 0/6] Checkpatch cleanup in rxtx.c Alison Schofield
2022-10-29 7:39 ` Greg KH
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=Y1za5Gzr/uXsPF3N@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
--cc=tanjubrunostar0@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