Re: union: was: Re: [PATCH printk v1 05/18] printk: Add non-BKL console basic infrastructure
From: John Ogness
Date: Mon Mar 27 2023 - 12:30:11 EST
On 2023-03-21, Petr Mladek <pmladek@xxxxxxxx> wrote:
> It is not completely clear that that this struct is stored
> as atomic_long_t atomic_state[2] in struct console.
>
> What about adding?
>
> atomic_long_t atomic;
The struct is used to simplify interpretting and creating values to be
stored in the atomic state variable. I do not think it makes sense that
the atomic variable type itself is part of it.
> Anyway, we should at least add a comment into struct console
> about that atomic_state[2] is used to store and access
> struct cons_state an atomic way. Also add a compilation
> check that the size is the same.
A compilation check would be nice. Is that possible?
I am renaming the struct to nbcon_state. Also the variable will be
called nbcon_state. With the description updated, I think it makes it
clearer that "struct nbcon_state" is used to interpret/create values of
console->nbcon_state.
John Ogness