Re: [PATCH v1 9/9] drm: Unify coding style for *_device_id arrays

From: Jani Nikula

Date: Wed Nov 18 2026 - 11:52:55 EST


On Wed, 18 Nov 2026, Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> wrote:
> Hello Jani,
>
> On Wed, Nov 18, 2026 at 03:27:40PM +0200, Jani Nikula wrote:
>> > [...]
>> > drivers/gpu/ipu-v3/ipu-common.c | 8 +-
>> > drivers/gpu/ipu-v3/ipu-pre.c | 4 +-
>> > drivers/gpu/ipu-v3/ipu-prg.c | 4 +-
>> > 254 files changed, 1155 insertions(+), 940 deletions(-)
>>
>> How do you expect a patch of this size be merged?
>
> Using b4 am :-) Honestly, in the cover letter I wrote about an immutable
> branch and offered to rebase to 7.4-rc1. When trying to apply this
> series on top ov 7.4-rc1 there are only 6 conflicts (1x modify/delete
> and 5x content); these are all not so hard to resolve (and even dropping
> the respective hunks (i.e. resolving using `git checkout HEAD`) is fine
> for me.)
>
>> > diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
>> > index 84a7dc6ab5db..faceb3de4fa3 100644
>> > --- a/drivers/gpu/drm/i915/i915_pci.c
>> > +++ b/drivers/gpu/drm/i915/i915_pci.c
>> > @@ -870,7 +870,7 @@ static const struct pci_device_id pciidlist[] = {
>> > INTEL_ATS_M_IDS(INTEL_VGA_DEVICE, &ats_m_info),
>> > INTEL_ARL_IDS(INTEL_VGA_DEVICE, &mtl_info),
>> > INTEL_MTL_IDS(INTEL_VGA_DEVICE, &mtl_info),
>> > - {}
>> > + { }
>>
>> Personally, I would *always* use {} instead of { }, and would rather not
>> change.
>>
>> Across the tree, {} is slightly more common than { }. IMO changing them
>> is pointless churn.
>
> It depends on how you count. My statistic looks as follows (on top of
> next-20261117):
>
> $ git grep -l device_id | xargs -n 1 perl -g -n -e 'print "$1\n" if m/device_id\s*[a-zA-Z_0-9]*\[\]\s*=\s*{(?:\s*{[^}]*},\s*({\s*}))/' | sort | uniq -c
> 2 }
> 2 {
> 6 { }
> 2598 { }
> 1262 {}
>
> So over all *_device_id { } is more common by a factor of > 2. This
> series fixes one { } and reduces the number of {} by 37. For only
> pci_device_id it's:
>
> $ git grep -l pci_device_id | xargs -n 1 perl -g -n -e 'print "$1\n" if m/pci_device_id\s*[a-zA-Z_0-9]*\[\]\s*=\s*{(?:\s*{[^}]*},\s*({\s*}))/' | sort | uniq -c
> 159 { }
> 32 {}
>
> Without the context of an array initializer there are many empty
> code blocks (function bodys or `do {} while (0)`), empty dt nodes, and
> {} in Rust code, which IMHO have to be considered off-topic for this
> statistic.

I realize my phrasing was careless.

My point was not so much about one being more common than the other, but
rather that there are *thousands* of instances of both, specifically as
C compound literals with empty initializer list. I think it's pointless
to convert one to other, regardless of whether you're adding or removing
a space.

I mentioned my preference, because if I were to go on a style fixing
spree, I'd go the other direction. But I think that too would be
pointless.

I suggest to just accept either.


BR,
Jani.


--
Jani Nikula, Intel