From: Joe Perches <joe@perches.com>
To: Ryan Mallon <rmallon@gmail.com>
Cc: Andrew Miller <amiller@amilx.com>,
gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: rtl8187se: r8180_core.c: Fix coding style issue
Date: Tue, 13 Mar 2012 21:49:15 -0700 [thread overview]
Message-ID: <1331700555.27389.51.camel@joe2Laptop> (raw)
In-Reply-To: <4F601C02.8070909@gmail.com>
On Wed, 2012-03-14 at 15:18 +1100, Ryan Mallon wrote:
> That's still pretty nasty. Eight lines for an if expression! It took me
> a couple of glances to realise that there were only two arguments to
> eqMacAddr. If you add some temporary variables then you can make the
> code a lot more sane, without making it overly verbose:
>
> u8 *addr, *bssid = priv->ieee80211->current_network.bssid;
>
> if (fc & IEEE80211_FCTL_TODS)
> addr = hdr->addr1;
> else if (fc & IEEE80211_FCTL_FROMDS)
> addr = hdr->addr2;
> else
> addr = hdr->addr3;
>
> if (!bHwError && !bCRC && !bICV &&
> type != IEEE80211_FTYPE_CTL && eqMacAddr(bssid, addr)) {
> ...
>
> Also note that the whole if block is indented one too many tab stops.
> Would be best to fix that in a separate patch though. If you fix that
> first, then you will have more horizontal space to re-organise the
> expression inside the if :-).
Yeah, what Ryan said. Clarity is good.
You might separate the addr and bssid declarations
into 2 lines though...
next prev parent reply other threads:[~2012-03-14 4:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-14 0:58 Andrew Miller
2012-03-14 1:33 ` Joe Perches
2012-03-14 1:49 ` Andrew Miller
2012-03-14 2:12 ` Joe Perches
2012-03-14 2:33 ` Andrew Miller
2012-03-14 2:46 ` Joe Perches
2012-03-14 3:09 ` Larry Finger
2012-03-14 2:54 ` Greg KH
2012-03-14 4:18 ` Ryan Mallon
2012-03-14 4:49 ` Joe Perches [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-03-11 4:32 Andrew Miller
2012-03-13 22:42 ` 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=1331700555.27389.51.camel@joe2Laptop \
--to=joe@perches.com \
--cc=amiller@amilx.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmallon@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
all inboxes | Powered by JetHome®