[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Oct 2018 18:16:32 +0100
From: John Garry <john.garry@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Kalle Valo <kvalo@...eaurora.org>, <johannes@...solutions.net>,
<jakub.kicinski@...ronome.com>, <yamada.masahiro@...ionext.com>,
Arnd Bergmann <arnd@...db.de>, <viro@...iv.linux.org.uk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Question on FIELD_PREP() for static array
(to: get_maintainers -f include/linux/bitfield.h)
Hi,
I would like to use FIELD_PREP() macro for assigning a static array,
like this:
function()
{
static u32 val[2] = {FIELD_PREP(GENMASK_ULL(10, 0), 5), 0};
}
However the compiler complains of non-const expression:
./include/linux/bitfield.h:88:2: error: initializer element is not constant
({ \
Specifically it doesn't like the __BF_FIELD_CHECK() in FIELD_PREP().
Any ideas on compiler trickery we could do with the FIELD_PREP()
definition to avoid this issue (i.e. enforce the check but only use the
constant value)?
Thanks in advance,
John
Powered by blists - more mailing lists