From: Maximilian Luz <luzmaximilian@gmail.com>
To: "Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers
Date: Sun, 21 Jun 2026 15:32:39 +0200 [thread overview]
Message-ID: <6a59a921-c799-489b-a0da-c926588a1d67@gmail.com> (raw)
In-Reply-To: <4421c8c959452d8a717ebc7cc905ad9c2912680c.1781522576.git.u.kleine-koenig@baylibre.com>
Am 15.06.2026 um 13:28 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.
>
> 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@baylibre.com>
> ---
> Hello,
>
> the mentioned change to ssam_device_id is similar to
> https://lore.kernel.org/all/cover.1779878004.git.u.kleine-koenig@baylibre.com/.
>
> 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.
I assume that will be a separate change or am I missing something in this patch?
> But IMHO the improved readability alone also justifies this change.
>
> Best regards
> uwe
Looks good to me, agreed on the readability part.
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
>
> drivers/platform/surface/surface_aggregator_hub.c | 9 +++++++--
> drivers/platform/surface/surface_aggregator_tabletsw.c | 9 +++++++--
> 2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c
> index 8b8b80228c14..541e9180f976 100644
> --- a/drivers/platform/surface/surface_aggregator_hub.c
> +++ b/drivers/platform/surface/surface_aggregator_hub.c
> @@ -348,8 +348,13 @@ static const struct ssam_hub_desc kip_hub = {
> /* -- Driver registration. -------------------------------------------------- */
>
> static const struct ssam_device_id ssam_hub_match[] = {
> - { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub },
> - { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub },
> + {
> + SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_KIP, 0x00),
> + .driver_data = (unsigned long)&kip_hub,
> + }, {
> + SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_BAS, 0x00),
> + .driver_data = (unsigned long)&base_hub,
> + },
> { }
> };
> MODULE_DEVICE_TABLE(ssam, ssam_hub_match);
> diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
> index ffa36ed92897..13031c329553 100644
> --- a/drivers/platform/surface/surface_aggregator_tabletsw.c
> +++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
> @@ -622,8 +622,13 @@ static const struct ssam_tablet_sw_desc ssam_pos_sw_desc = {
> /* -- Driver registration. -------------------------------------------------- */
>
> static const struct ssam_device_id ssam_tablet_sw_match[] = {
> - { SSAM_SDEV(KIP, SAM, 0x00, 0x01), (unsigned long)&ssam_kip_sw_desc },
> - { SSAM_SDEV(POS, SAM, 0x00, 0x01), (unsigned long)&ssam_pos_sw_desc },
> + {
> + SSAM_SDEV(KIP, SAM, 0x00, 0x01),
> + .driver_data = (unsigned long)&ssam_kip_sw_desc,
> + }, {
> + SSAM_SDEV(POS, SAM, 0x00, 0x01),
> + .driver_data = (unsigned long)&ssam_pos_sw_desc,
> + },
> { },
> };
> MODULE_DEVICE_TABLE(ssam, ssam_tablet_sw_match);
>
> base-commit: c425609d6ac4012c8bbf01ec2e10e801b1923a7b
next prev parent reply other threads:[~2026-06-21 13:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 11:28 Uwe Kleine-König (The Capable Hub)
2026-06-21 13:32 ` Maximilian Luz [this message]
2026-07-01 11:31 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a59a921-c799-489b-a0da-c926588a1d67@gmail.com \
--to=luzmaximilian@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®