From: Joe Perches <joe@perches.com>
To: Kien Ha <kienha9922@gmail.com>,
linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Subject: Re: [PATCH] Fix line too long warning
Date: Sun, 29 Oct 2017 08:19:42 -0700 [thread overview]
Message-ID: <1509290382.26592.7.camel@perches.com> (raw)
In-Reply-To: <1509245173.3669.5.camel@gmail.com>
On Sat, 2017-10-28 at 22:46 -0400, Kien Ha wrote:
> From fc52a98aca0c033f2c03fdc7e8f83ae49625675a Mon Sep 17 00:00:00 2001
> From: Kien Ha <kienha9922@gmail.com>
> Date: Fri, 27 Oct 2017 14:07:55 -0400
> Subject: [PATCH] Fix line too long warning
>
> Signed-off-by: Kien Ha <kienha9922@gmail.com>
Hi.
Instead of merely shutting up checkpatch warnings,
always try to improve the code instead.
Look at the flow of this cascaded if / else { if
and transform it to a simpler if ... else if ... else if ...
if (sta && sta->vht_cap.vht_supported) {
tcb_desc->hw_rate =
_rtl_get_vht_highest_n_rate(hw, sta);
} else {
if (sta && (sta->ht_cap.ht_supported)) {
tcb_desc->hw_rate =
_rtl_get_highest_n_rate(hw, sta);
} else {
if (rtlmac->mode == WIRELESS_MODE_B) {
tcb_desc->hw_rate =
rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M];
} else {
tcb_desc->hw_rate =
rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M];
}
}
}
This block could be
tcb_desc->hw_rate =
sta && sta->vht_cap.vht_supported ?
_rtl_get_vht_highest_n_rate(hw, sta) :
sta && sta->ht_cap.ht_supported ?
_rtl_get_highest_n_rate(hw, sta) :
rtlmac->mode == WIRELESS_MODE_B ?
rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M] :
rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M];
which seems easier to read.
next prev parent reply other threads:[~2017-10-29 15:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-29 2:46 [PATCH] Fix line too long warning Kien Ha
2017-10-29 15:19 ` Joe Perches [this message]
2017-10-29 15:54 ` Yury Norov
2017-10-29 16:29 ` Yury Norov
2017-10-29 17:22 ` Kien Ha
2017-10-29 17:28 ` Joe Perches
2017-10-29 18:34 ` Yury Norov
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=1509290382.26592.7.camel@perches.com \
--to=joe@perches.com \
--cc=devel@driverdev.osuosl.org \
--cc=kienha9922@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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.