From: Joe Perches <joe@perches.com>
To: Joseph-Eugene Winzer <m999@openmailbox.org>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] drivers: staging: rtl8192u: fixing coding style issues in r8192U_core.c
Date: Fri, 17 Jul 2015 17:11:34 -0700 [thread overview]
Message-ID: <1437178294.2495.102.camel@perches.com> (raw)
In-Reply-To: <1437141560-22517-2-git-send-email-m999@openmailbox.org>
On Fri, 2015-07-17 at 15:59 +0200, Joseph-Eugene Winzer wrote:
> Reformatting the code without introducing other warnings
> like 'Avoid unnecessary line continuations' or breaking strings.
Very few of these seem to be improvements and many
of them should likely be in separate patches.
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
[]
> @@ -143,17 +143,35 @@ struct CHANNEL_LIST {
> };
>
> static struct CHANNEL_LIST ChannelPlan[] = {
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165}, 24}, /* FCC */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, /* IC */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, /* ETSI */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* Spain. Change to ETSI. */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* France. Change to ETSI. */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* MKK //MKK */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* MKK1 */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* Israel. */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* For 11a , TELEC */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* MIC */
> - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14} /* For Global Domain. 1-11:active scan, 12-14 passive scan. //+YJ, 080626 */
If these were to be reformatted, it'd probably be better
to use 10 per line so that the Len value that follows is
more obvious. Likely this struct should be const too.
Maybe something like:
static const struct CHANNEL_LIST ChannelPlan[] = {
{
.Channel = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 36, 40, 44, 48, 52, 56, 60, 64,149,
153,157,161,165
},
.Len = 24,
},
etc. Add more spaces between channels if you really want.
> @@ -179,7 +197,9 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv)
> min_chan = 1;
> max_chan = 14;
> } else {
> - RT_TRACE(COMP_ERR, "unknown rf chip, can't set channel map in function:%s()\n", __func__);
> + RT_TRACE(COMP_ERR,
> + "unknown rf chip, can't set channel map in function:%s()\n"
> + , __func__);
No leading commas please. Put the comma after the format.
> @@ -187,7 +207,10 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv)
> sizeof(GET_DOT11D_INFO(ieee)->channel_map));
> /* Set new channel map */
> for (i = 0; i < ChannelPlan[channel_plan].Len; i++) {
> - if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan)
> + if (ChannelPlan[channel_plan].Channel[i] <
> + min_chan ||
> + ChannelPlan[channel_plan].Channel[i] >
> + max_chan)
Likely better to use a temporary for ChannelPlan[channel_plan]
so these could become:
if (cp->Channel[i] < min_chan ||
cp->Channel[i] > max_chan)
etc...
> @@ -1490,7 +1523,8 @@ static u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc)
> {
> u8 tmp_Short;
>
> - tmp_Short = (TxHT == 1) ? ((tcb_desc->bUseShortGI) ? 1 : 0) : ((tcb_desc->bUseShortPreamble) ? 1 : 0);
> + tmp_Short = (TxHT == 1) ? ((tcb_desc->bUseShortGI) ? 1 : 0) :
> + ((tcb_desc->bUseShortPreamble) ? 1 : 0);
>
> if (TxHT == 1 && TxRate != DESC90_RATEMCS15)
> tmp_Short = 0;
Maybe using bool would be better.
> @@ -1673,7 +1711,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb)
> 0, tx_zero_isr, dev);
> status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
> if (status) {
> - RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
> + RT_TRACE(COMP_ERR,
> + "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
Probably better line wrapped after format
etc...
next prev parent reply other threads:[~2015-07-18 0:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-17 13:59 [PATCH 1/5] drivers: staging: rtl8192u: fixing coding style issues in r8192U_core.c Joseph-Eugene Winzer
2015-07-17 13:59 ` [PATCH 2/5] " Joseph-Eugene Winzer
2015-07-18 0:11 ` Joe Perches [this message]
2015-07-18 12:29 ` m999
2015-07-19 10:48 ` Dan Carpenter
2015-07-17 13:59 ` [PATCH 3/5] drivers: staging: rtl8192u: removed pointer check for kfree " Joseph-Eugene Winzer
2015-07-17 13:59 ` [PATCH 4/5] drivers: staging: rtl8192u: included linux/uaccess.h instead of asm/uaccess.h Joseph-Eugene Winzer
2015-07-17 13:59 ` [PATCH 5/5] drivers: staging: rtl8192u: fixed coding style issues in r8192U_core.c Joseph-Eugene Winzer
2015-07-18 0:15 ` Joe Perches
2015-07-23 4:02 ` [PATCH 1/5] drivers: staging: rtl8192u: fixing " 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=1437178294.2495.102.camel@perches.com \
--to=joe@perches.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m999@openmailbox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox