Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Christoffer Holmstedt <christoffer.holmstedt@gmail.com>
Cc: linux-wpan@vger.kernel.org
Subject: Re: First kernel patch - checkpatch for at86rf230.c, false-positives?
Date: Thu, 23 Apr 2015 12:09:23 +0200	[thread overview]
Message-ID: <20150423100918.GA9284@omega> (raw)
In-Reply-To: <CAG9Fz+uvR29TX4-MavSqA=MPkUhsn7n0HnaDzh4PDAmrMvrsVQ@mail.gmail.com>

On Thu, Apr 23, 2015 at 11:48:07AM +0200, Christoffer Holmstedt wrote:
> Hi
> I've access to a few raspberry pi:s with the openlabs extension board
> and I'm currently configuring my development environment for kernel
> development to help out with the wpan subsystem.
> 
> I just ran checkpatch.pl over at86rf230.c and got 109 errors most of
> them concerning macros not enclosed in parentheses. Are these
> false-positives or should I add parantheses?
> 

definitely false positiv!

what they do there is parameters for functions in a define.

Like:

#define STATIC_VALUES_PARAMETERS 1, 2, 3

void function(void *p, int first, int second, int third, void *foobar)
{
	....
}

and call later;

function(bar, STATIC_VALUES_PARAMETERS, foo);

compiler will replace it with:

function(bar, 1, 2, 3, foo);

and it's wrong to use:

function(bar, (1, 2, 3), foo);

it's not usually kernel programming and historical copy&pasted from
contiki code [0] or maybe contiki copy&pasted it from linux, I don't
know I don't programmed it.


checkpatch warnings about this because it's complicated to use logical
operations define inside another logical operations define. like:
BAR_MASK(FOO_MASK(bar)) - without brackets it's hard to understand
what's going on there.
But this isn't the case here.


btw:

There exists an code styling issue which is not shown by checkpatch.
It's the tab after every define, I have patches for this I will send
them later, it's included for the RFC to add phy capabilities dump.

- Alex

[0] https://github.com/contiki-os/contiki/blob/master/cpu/avr/radio/rf230/at86rf230_registermap.h

  reply	other threads:[~2015-04-23 10:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  9:48 First kernel patch - checkpatch for at86rf230.c, false-positives? Christoffer Holmstedt
2015-04-23 10:09 ` Alexander Aring [this message]
2015-04-23 10:25   ` Christoffer Holmstedt
2015-04-23 11:15     ` Alexander Aring
2015-04-23 11:48       ` Christoffer Holmstedt
2015-04-23 12:08         ` Alexander Aring

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=20150423100918.GA9284@omega \
    --to=alex.aring@gmail.com \
    --cc=christoffer.holmstedt@gmail.com \
    --cc=linux-wpan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox