Re: [PATCH v1] power: supply: surface_{battery,charger}: Consistently define ssam_device_ids using named initializers

From: Uwe Kleine-König (The Capable Hub)

Date: Mon Jun 22 2026 - 05:48:25 EST


Hello Maximilian,

On Sun, Jun 21, 2026 at 03:32:45PM +0200, Maximilian Luz wrote:
> Am 15.06.2026 um 14:51 schrieb Uwe Kleine-König (The Capable Hub):
> > The .driver_data member of the the two struct ssam_device_id arrays were
> > initialized by list expressions. This isn't easily readable if you don't
> > work with the Surface System Aggregator core regularily. Using named
> > initializers is more explicit and thus easier to parse and also more
> > robust to changes of the struct definition. This robustness is relevant
> > for a planned change to struct ssam_device_id replacing .driver_data
> > by an anonymous union.
> >
> > While touching these arrays, also drop the comma after the list
> > terminators.
> >
> > This change doesn't introduce changes to the compiled ssam_device_id
> > arrays.
> >
> > Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
> > ---
> > Hello,
> >
> > the mentioned change to ssam_device_id is similar to
> > https://lore.kernel.org/all/cover.1779878004.git.u.kleine-koenig@xxxxxxxxxxxx/.
> >
> > That allows to get rid of the casts in these two drivers and thus
> > benefits a bit more of the (admittedly weak) type safety of C.
>
> As in the prior patch: I assume that will be a separate change or am I
> missing something in this patch?

Yes, this can only happen when all drivers use a named initializer for
.driver_data. As this requires adaptions to many subsystems, it's not
included here.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature