Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1169703
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: Coding style details (checkpatch) |
| Date | 2015-06-22 08:20 +0200 |
| Message-ID | <pE3fj-3OG-5@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <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> |
| Organization | linux.* mail to news gateway |
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
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