public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Joe Perches <joe@perches.com>
Cc: Roland Vossen <rvossen@broadcom.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Checkpatch.pl generates false alarm
Date: Tue, 12 Jul 2011 09:03:26 +0100	[thread overview]
Message-ID: <20110712080326.GA1065@shadowen.org> (raw)
In-Reply-To: <1310444606.6925.4.camel@Joe-Laptop>

On Mon, Jul 11, 2011 at 09:23:26PM -0700, Joe Perches wrote:
> On Mon, 2011-07-11 at 16:48 +0200, Roland Vossen wrote:
> > Hello Andy,
> > 
> > when I feed attached file to checkpatch, several warnings are given, but 
> > this one:
> > 
> > WARNING: externs should be avoided in .c files
> > #3555: FILE: staging/brcm80211/brcmsmac/main.c:3555:
> > +       END_FOREACH_BSS
> > 
> > does not seem to make sense. When I place a comment behind the 
> > END_FOREACH_BSS line, the checkpatch warning disappears.
> > 
> > Let me know if you need additional info to work on this.
> 
> I think this code is bad form and confuses checkpatch:
> 
> 	/* update the capability based on current shortslot mode */
> 	FOREACH_BSS(wlc, idx, cfg)
> 		if (!cfg->associated)
> 			continue;
> 		cfg->current_bss->capability &=
> 					~WLAN_CAPABILITY_SHORT_SLOT_TIME;
> 		if (wlc->shortslot)
> 			cfg->current_bss->capability |=
> 					WLAN_CAPABILITY_SHORT_SLOT_TIME;
> 	END_FOREACH_BSS
> 
> I think this code is still slightly bad form, but it isn't a problem
> for checkpatch:
> 
> 	/* update the capability based on current shortslot mode */
> 	FOREACH_BSS(wlc, idx, cfg) {
> 		if (!cfg->associated)
> 			continue;
> 		cfg->current_bss->capability &=
> 					~WLAN_CAPABILITY_SHORT_SLOT_TIME;
> 		if (wlc->shortslot)
> 			cfg->current_bss->capability |=
> 					WLAN_CAPABILITY_SHORT_SLOT_TIME;
> 	} END_FOREACH_BSS

Yeah I can only concur that this is the more normal form for such fake
loop structures which needs begins and ends.  I don't think we are going
to be able to trivially figure out this is a loop otherwise.

-apw

      reply	other threads:[~2011-07-12  8:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 14:48 Checkpatch.pl generates false alarm Roland Vossen
2011-07-12  4:23 ` Joe Perches
2011-07-12  8:03   ` Andy Whitcroft [this message]

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=20110712080326.GA1065@shadowen.org \
    --to=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rvossen@broadcom.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