[PATCH] i3c: master: use named initializers for acpi_device_id

Pawel Zalewski posted 1 patch 21 hours ago
drivers/i3c/master/dw-i3c-master.c     | 4 ++--
drivers/i3c/master/mipi-i3c-hci/core.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
[PATCH] i3c: master: use named initializers for acpi_device_id
Posted by Pawel Zalewski 21 hours ago
Use a designated initializer for the acpi_device_id fields which makes the
code more readable and consistent with how lists are initialized in the
rest of the kernel code base.

Unify the list terminator to have a single space between the brackets and
no trailing comma.

Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
---
This series is converting lists that contain the acpi_device_id struct,
which is defined in the include/linux/device-id/acpi.h to make use of named
initializers (which they do not use currently). This work is part of the on
going effort in the kernel associated with device-ids [1]

The plan is to convert acpi_device_id::driver_data to have an anonymous
union, similarly to what was introduced for PCI and I2C device ID tables.
The goal is to increase type-safety (most of the existing casts are gone),
to improve readability and to make use intent a bit more clear:

```
union {
	kernel_ulong_t driver_data;
	const void *driver_data_ptr;
}
```

But for that to work all lists containing the structs need to use named
initializers first to avoid triggering -Wmissing-braces. I already have
patches that implement this and touching a lot of kernel subsystmes that
use the acpi_device_id struct and that list keeps on growing. Therefore,
I have decided to split the series per every subsystem into:
- pre-clean-ups that convert the lists to use named initializers
  (which is this series)
- actual implementations that make some of the modules use the new
  driver_data_ptr member

That way the task can be fragmented into manageable and independent chunks
of work and makes this effort easier to review.

Tested builds on x86-64 and a64 in Yocto using 7.3-rc4.

[1] https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/
---
 drivers/i3c/master/dw-i3c-master.c     | 4 ++--
 drivers/i3c/master/mipi-i3c-hci/core.c | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 4563d8761ba0..05584ddaf104 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1934,8 +1934,8 @@ static const struct of_device_id dw_i3c_master_of_match[] = {
 MODULE_DEVICE_TABLE(of, dw_i3c_master_of_match);
 
 static const struct acpi_device_id dw_i3c_master_acpi_match[] = {
-	{ "AMDI0015", AMD_I3C_OD_PP_TIMING },
-	{ "NVDA2018", DW_I3C_ACPI_SKIP_CLK_RST },
+	{ .id = "AMDI0015", .driver_data = AMD_I3C_OD_PP_TIMING },
+	{ .id = "NVDA2018", .driver_data = DW_I3C_ACPI_SKIP_CLK_RST },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, dw_i3c_master_acpi_match);
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index dadf049bd4b5..5b8d84d0106e 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -1205,8 +1205,10 @@ static const __maybe_unused struct of_device_id i3c_hci_of_match[] = {
 MODULE_DEVICE_TABLE(of, i3c_hci_of_match);
 
 static const struct acpi_device_id i3c_hci_acpi_match[] = {
-	{ "AMDI5017", HCI_QUIRK_PIO_MODE | HCI_QUIRK_OD_PP_TIMING | HCI_QUIRK_RESP_BUF_THLD },
-	{}
+	{ .id = "AMDI5017",
+	  .driver_data = HCI_QUIRK_PIO_MODE | HCI_QUIRK_OD_PP_TIMING |
+					 HCI_QUIRK_RESP_BUF_THLD },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match);
 

---
base-commit: fe2ec83746e501645709761605c2464a44fd2929
change-id: 20260923-acpi-i3c-4cc518a8e77b

Best regards,
--  
Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
Re: [PATCH] i3c: master: use named initializers for acpi_device_id
Posted by Frank Li 20 hours ago
On Wed, Sep 23, 2026 at 04:47:05PM +0100, Pawel Zalewski wrote:
> Use a designated initializer for the acpi_device_id fields which makes the
> code more readable and consistent with how lists are initialized in the
> rest of the kernel code base.
>
> Unify the list terminator to have a single space between the brackets and
> no trailing comma.
>
> Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> This series is converting lists that contain the acpi_device_id struct,
> which is defined in the include/linux/device-id/acpi.h to make use of named
> initializers (which they do not use currently). This work is part of the on
> going effort in the kernel associated with device-ids [1]
>
> The plan is to convert acpi_device_id::driver_data to have an anonymous
> union, similarly to what was introduced for PCI and I2C device ID tables.
> The goal is to increase type-safety (most of the existing casts are gone),
> to improve readability and to make use intent a bit more clear:
>
> ```
> union {
> 	kernel_ulong_t driver_data;
> 	const void *driver_data_ptr;
> }
> ```
>
> But for that to work all lists containing the structs need to use named
> initializers first to avoid triggering -Wmissing-braces. I already have
> patches that implement this and touching a lot of kernel subsystmes that
> use the acpi_device_id struct and that list keeps on growing. Therefore,
> I have decided to split the series per every subsystem into:
> - pre-clean-ups that convert the lists to use named initializers
>   (which is this series)
> - actual implementations that make some of the modules use the new
>   driver_data_ptr member
>
> That way the task can be fragmented into manageable and independent chunks
> of work and makes this effort easier to review.
>
> Tested builds on x86-64 and a64 in Yocto using 7.3-rc4.
>
> [1] https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/
> ---
>  drivers/i3c/master/dw-i3c-master.c     | 4 ++--
>  drivers/i3c/master/mipi-i3c-hci/core.c | 6 ++++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 4563d8761ba0..05584ddaf104 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1934,8 +1934,8 @@ static const struct of_device_id dw_i3c_master_of_match[] = {
>  MODULE_DEVICE_TABLE(of, dw_i3c_master_of_match);
>
>  static const struct acpi_device_id dw_i3c_master_acpi_match[] = {
> -	{ "AMDI0015", AMD_I3C_OD_PP_TIMING },
> -	{ "NVDA2018", DW_I3C_ACPI_SKIP_CLK_RST },
> +	{ .id = "AMDI0015", .driver_data = AMD_I3C_OD_PP_TIMING },
> +	{ .id = "NVDA2018", .driver_data = DW_I3C_ACPI_SKIP_CLK_RST },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, dw_i3c_master_acpi_match);
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index dadf049bd4b5..5b8d84d0106e 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -1205,8 +1205,10 @@ static const __maybe_unused struct of_device_id i3c_hci_of_match[] = {
>  MODULE_DEVICE_TABLE(of, i3c_hci_of_match);
>
>  static const struct acpi_device_id i3c_hci_acpi_match[] = {
> -	{ "AMDI5017", HCI_QUIRK_PIO_MODE | HCI_QUIRK_OD_PP_TIMING | HCI_QUIRK_RESP_BUF_THLD },
> -	{}
> +	{ .id = "AMDI5017",
> +	  .driver_data = HCI_QUIRK_PIO_MODE | HCI_QUIRK_OD_PP_TIMING |
> +					 HCI_QUIRK_RESP_BUF_THLD },
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match);
>
>
> ---
> base-commit: fe2ec83746e501645709761605c2464a44fd2929
> change-id: 20260923-acpi-i3c-4cc518a8e77b
>
> Best regards,
> --
> Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
>