Re: static key arrays?

From: Rasmus Villemoes
Date: Fri Sep 11 2015 - 10:41:34 EST


On Fri, Sep 11 2015, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote:

> On Fri, 2015-09-11 at 13:10 +0200, Peter Zijlstra wrote:
>>
>> struct static_key_false array[n] = { STATIC_KEY_FALSE_INIT, };
>>
>> or something like that.
>
> Yeah, ok, this would be sufficient for me - no need to mix different
> types. I don't think that initializer works, but I guess we can just
> duplicate it in the code

That's inconvenient for large arrays. I think the 'or something' would
be the range initialization supported by gcc (and I think also clang):

struct static_key_false array[N] = { [0 ... N-1] = STATIC_KEY_FALSE_INIT };

Rasmus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/