Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1169703

Re: Coding style details (checkpatch)

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: Coding style details (checkpatch)
Date Mon, 22 Jun 2015 08:20:01 +0200
Message-ID <pE3fj-3OG-5@gated-at.bofh.it> (permalink)
References <pD00a-25F-29@gated-at.bofh.it> <pD0tc-2Tl-3@gated-at.bofh.it> <pD1Sh-4Mq-9@gated-at.bofh.it> <pD1Si-4Mq-25@gated-at.bofh.it> <pD2bE-59i-17@gated-at.bofh.it> <pD5VU-26b-9@gated-at.bofh.it> <pE2CC-2QP-7@gated-at.bofh.it>
X-Original-To Krzysztof Hałasa <khalasa@piap.pl>
X-Session-Marker 6A6F6540706572636865732E636F6D
X-Spam-Summary 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:152:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:3872:4321:4605:5007:6261:8784:10004:10400:10848:11026:11232:11473:11658:11914:12517:12519:12740:13069:13141:13230:13311:13357:13848:13894:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0
X-He-Tag girls82_505e23417ba29
X-Filterd-Recvd-Size 2103
Content-Type text/plain; charset="UTF-8"
X-Mailer Evolution 3.12.11-0ubuntu3
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 39
Organization linux.* mail to news gateway
X-Original-Cc Frans Klaver <fransklaver@gmail.com>, Andy Whitcroft <apw@canonical.com>, lkml <linux-kernel@vger.kernel.org>
X-Original-Date Sun, 21 Jun 2015 23:12:31 -0700
X-Original-Message-ID <1434953551.9808.19.camel@perches.com>
X-Original-References <m3r3p8rt7w.fsf@t19.piap.pl> <CAH6sp9M7R3chHA+FPG6WV5LqwPy7+TDy1P9qjcfmNAGzALhKOg@mail.gmail.com> <m3fv5ornur.fsf_-_@t19.piap.pl> <CAH6sp9N-e-uGu65B7XsFfqqR100bjWpShHaH613EuMJLQS1a7w@mail.gmail.com> <m3bngcrmvd.fsf@t19.piap.pl> <1434725667.2689.121.camel@perches.com> <m37fqws3wp.fsf@t19.piap.pl>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1169703

Show key headers only | View raw


On Mon, 2015-06-22 at 07:33 +0200, Krzysztof Hałasa wrote:
> Joe Perches <joe@perches.com> writes:
> 
> > How is the macro used?
> > #define REG8_1(a0) ((const u16[8]){a0, a0 + 1, a0 + 2, a0 + 3})
> 
> #define REG8_1(a0) ((const u16[8]){a0, a0 + 1, a0 + 2, a0 + 3, a0 + 4, a0 + 5, a0 + 6, a0 + 7})
[]
> #define VDMA_CHANNEL_CONFIG     REG8_1(0x10)
[]
>         reg_write(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch], dma_cfg);
[]
> ERROR: space required before the open brace '{'
> +#define REG8_1(a0) ((const u16[8]){a0, a0 + 1, a0 + 2, a0 + 3})
> 
> Does this qualify as the "false positive"?

Probably, yes.  Is it worth fixing?  Probably not.

It might be better to use some base + index macro
as it could be smaller object code.

Something like:

#define REG_NO(base, multiplier, index)	(base + (multiplier * index))

	reg_write(vc->dev, REG_NO(0x10, 1, vc->ch), dma_cfg);
or

#define VDMA_CHANNEL_CONFIG	0x10

	reg_write(vc->dev, REG_NO(VDMA_CHANNEL_CONFIG, 1, vc->ch), dma_cfg);

etc...


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Coding style details khalasa@piap.pl (Krzysztof Hałasa) - 2015-06-19 10:40 +0200
  Re: Coding style details Frans Klaver <fransklaver@gmail.com> - 2015-06-19 11:10 +0200
    Re: Coding style details (checkpatch) khalasa@piap.pl (Krzysztof Hałasa) - 2015-06-22 07:40 +0200
      Re: Coding style details (checkpatch) Joe Perches <joe@perches.com> - 2015-06-22 08:20 +0200
        Re: Coding style details (checkpatch) khalasa@piap.pl (Krzysztof Hałasa) - 2015-06-22 08:40 +0200
          Re: Coding style details (checkpatch) Joe Perches <joe@perches.com> - 2015-06-22 08:50 +0200

csiph-web