Skip to contentSkip to conversation

iommu/riscv: Use named initializers for acpi_device_id

PATCH Applied Pawel Zalewski 2 participants 2 messages Oct 14 – Nov 23

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/riscv: Use named initializers for acpi_device_id

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. Also drop explicitly setting fields to 0 where it is redundant.

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

---
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 (does not apply to this tree)

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

[1] https://lore.kernel.org/all/[email protected]/

---
 drivers/iommu/riscv/iommu-platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/riscv/iommu-platform.c +2 -2
index 399ba8fe1b3e..5680424e36c4 100644
@@ -164,8 +164,8 @@ static const struct of_device_id riscv_iommu_of_match[] = {
 };
 
 static const struct acpi_device_id riscv_iommu_acpi_match[] = {
-	{ "RSCV0004", 0 },
-	{}
+	{ .id = "RSCV0004" },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, riscv_iommu_acpi_match);
 

---
base-commit: 4056b3c9d3c92ea45955641dbafeb9b960e146ef
change-id: 20261014-acpi-iommu-e11dedbd7aab

Best regards,

Signature · 1 line
Pawel Zalewski <[email protected]>
maintainer Applied
#1 lore raw
Quoted 2 lines · Pawel Zalewski
 drivers/iommu/riscv/iommu-platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.