On 7/20/25 8:50 AM, Brigham Campbell wrote:
On Sat Jul 19, 2025 at 11:10 AM MDT, Diogo Ivo wrote:
nit: can just be this:
struct mipi_dsi_multi_context dsi_ctx = {};
I am not an expert here but I was under the impression that this is only
valid with C23 while the kernel is written in C11. Is there something I
am missing?
Diogo
You're right, C23 was the first standard to bless the usage of the empty
initializer, ` = {};`, but if I'm right, it's been a GNU extension long
before C11. At risk of being pedantic, I'll draw attention to line 580
of the kernel's root Makefile:
KBUILD_CFLAGS += -std=gnu11
The kernel is technically written in the GNU variant of C11, extensions
and all. In fact, the first patch of this series uses optional variadic
macro arguments, which aren't a part of any official C standard as far
as I'm aware.
In any case, a simple grep for some forms of the empty initializer shows
usages all over the drm subsystem.
That said, I don't know if GNU extensions are formally documented or
where one would look for that information. Importantly, I am by far the
junior as far as kernel coding is concerned. I yield to your experience
and I'm happy to change this initialization in v6 if that's best.
I found the documentation here [1], and it does state regarding designated
initializers that "Omitted fields are implicitly initialized the same as for
objects that have static storage duration." so I take it that no v6 is
needed :)
Diogo
[1]:
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html#Designated-Inits