* [PATCH v1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers
@ 2026-06-15 11:28 Uwe Kleine-König (The Capable Hub)
2026-06-21 13:32 ` Maximilian Luz
2026-07-01 11:31 ` Ilpo Järvinen
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-15 11:28 UTC (permalink / raw)
To: Maximilian Luz, Hans de Goede, Ilpo Järvinen
Cc: platform-driver-x86, linux-kernel
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.
But IMHO the improved readability alone also justifies this change.
Best regards
uwe
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
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers
2026-06-15 11:28 [PATCH v1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
@ 2026-06-21 13:32 ` Maximilian Luz
2026-07-01 11:31 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Maximilian Luz @ 2026-06-21 13:32 UTC (permalink / raw)
To: Uwe Kleine-König (The Capable Hub),
Hans de Goede, Ilpo Järvinen
Cc: platform-driver-x86, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers
2026-06-15 11:28 [PATCH v1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
2026-06-21 13:32 ` Maximilian Luz
@ 2026-07-01 11:31 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2026-07-01 11:31 UTC (permalink / raw)
To: Maximilian Luz, Hans de Goede, Uwe Kleine-König (The Capable Hub)
Cc: platform-driver-x86, linux-kernel
On Mon, 15 Jun 2026 13:28:59 +0200, Uwe Kleine-König (The Capable Hub) wrote:
> 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.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
FYI [if applicable to your patch], as per Linus' policy change, also
fixes are mostly routed through for-next unless the fix is for a
commit introduced in the most recent or clearly a regression fix.
The list of commits applied:
[1/1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers
commit: d3f2ecd21924bc67c44ebd608e157a94b4ba4b62
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-01 11:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-15 11:28 [PATCH v1] platform/surface: aggregator: Consistently define ssam_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
2026-06-21 13:32 ` Maximilian Luz
2026-07-01 11:31 ` Ilpo Järvinen
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®