[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <73686985-27c4-4a4f-8b75-18df112367a7@tecnico.ulisboa.pt>
Date: Sun, 20 Jul 2025 12:19:37 +0100
From: Diogo Ivo <diogo.ivo@...nico.ulisboa.pt>
To: Brigham Campbell <me@...ghamcampbell.com>,
Doug Anderson <dianders@...omium.org>
Cc: tejasvipin76@...il.com, skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linux.dev, dri-devel@...ts.freedesktop.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Neil Armstrong <neil.armstrong@...aro.org>,
Jessica Zhang <jessica.zhang@....qualcomm.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>
Subject: Re: [PATCH v4 2/4] drm/panel: jdi-lpm102a188a: Fix bug and clean up
driver
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
Powered by blists - more mailing lists