Re: [PATCH] leds: Use named initializers for arrays of i2c_device_data

From: u.kleine-koenig@xxxxxxxxxxxx

Date: Mon May 18 2026 - 10:49:52 EST


Hello,

On Mon, May 18, 2026 at 09:53:42AM +0000, Sverdlin, Alexander wrote:
> On Fri, 2026-05-15 at 18:33 +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > While being less compact, using named initializers allows to more easily
> > see which members of the structs are assigned which value without having
> > to lookup the declaration of the struct. And it's also more robust
> > against changes to the struct definition.
> >
> > The mentioned robustness is relevant for a planned change to struct
> > i2c_device_id that replaces .driver_data by an anonymous union.
> >
> > While touching all these arrays, unify usage of whitespace and commas.
> >
> > This patch doesn't modify the compiled arrays, only their representation
> > in source form benefits. The former was confirmed with x86 and arm64
> > builds.
> >
> > Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
>
> the patch looks good overall, except one minor nit below and the fact that
> https://kernel.googlesource.com/pub/scm/linux/kernel/git/lee/leds for-leds-next
> branch already has commit c7dd343a37567e650c263d4c068418b0bb82bf79
> ("leds: as3668: Driver for the ams Osram 4-channel i2c LED driver"), which is
> not converted. Would it make sense to rebase and convert as3668 driver as well?

My tree is based on v7.1-rc1 and I expect to have missed some more
drivers. So I'm well aware that I won't be done with the quest when I
sent one patch per subsystem. I hesitate to base my development on top
of next because I juggle ~100 patches currently and there are more to
come.

I plan to address the missed drivers separately, so my preference would
be to not stop this patch from going in because of that missed driver,
but I adapt to whatever the LED maintainers POV is on that.

> > diff --git a/drivers/leds/leds-lp8501.c b/drivers/leds/leds-lp8501.c
> > index ee4ff4586bc0..946c27fd74cc 100644
> > --- a/drivers/leds/leds-lp8501.c
> > +++ b/drivers/leds/leds-lp8501.c
> > @@ -130,7 +130,7 @@ static struct lp55xx_device_config lp8501_cfg = {
> > };
> >
> > static const struct i2c_device_id lp8501_id[] = {
> > - { "lp8501", .driver_data = (kernel_ulong_t)&lp8501_cfg, },
> > + { .name = "lp8501", .driver_data = (kernel_ulong_t)&lp8501_cfg },
> ^^
> duplicate whitespace

Ah right, the double space is also in the source and my script kept
that. I fixed that in my tree, so if it comes to a v2 this will be
fixed.

Thanks for your feedback.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature