[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1434953551.9808.19.camel@perches.com>
Date: Sun, 21 Jun 2015 23:12:31 -0700
From: Joe Perches <joe@...ches.com>
To: Krzysztof Hałasa <khalasa@...p.pl>
Cc: Frans Klaver <fransklaver@...il.com>,
Andy Whitcroft <apw@...onical.com>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: Coding style details (checkpatch)
On Mon, 2015-06-22 at 07:33 +0200, Krzysztof Hałasa wrote:
> Joe Perches <joe@...ches.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/
Powered by blists - more mailing lists