dmaengine: use designated initializers for acpi_device_id
Subsystems (5)
v3 cover dmaengine: use designated initializers for acpi_device_id
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-rc2.
[1] https://lore.kernel.org/all/[email protected]/
---
Changes in v3:
- Changed the title tag to dmaengine; added Reviewed-by from V2.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Tidy up messages and wrapped at 75 chars; added Reviewed-bys from V1.
- Link to v1: https://patch.msgid.link/[email protected]
To: Viresh Kumar <[email protected]>
To: Andy Shevchenko <[email protected]>
To: Vinod Koul <[email protected]>
To: Frank Li <[email protected]>
To: Binbin Zhou <[email protected]>
To: Sinan Kaya <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Pawel Zalewski (4):
dmaengine: dw: use designated initializers for acpi_device_id
dmaengine: loongson: use named initializers for acpi_device_id
dmaengine: qcom: use named initializers for acpi_device_id
dmaengine: xgene-dma: use named initializers for acpi_device_id
drivers/dma/dw/platform.c | 12 ++++++------ drivers/dma/loongson/loongson2-apb-cmc-dma.c | 4 ++-- drivers/dma/qcom/hidma.c | 8 ++++---- drivers/dma/xgene-dma.c | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260904-acpi-dma-ee1add4bae4e
Best regards,
Signature · 1 line
Pawel Zalewski <[email protected]>
PATCH v3 1/4 dmaengine: dw: use designated initializers for acpi_device_id
Use a named 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.
--- drivers/dma/dw/platform.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/dma/dw/platform.c +6 -6
@@ -141,14 +141,14 @@ MODULE_DEVICE_TABLE(of, dw_dma_of_id_table);#ifdef CONFIG_ACPI static const struct acpi_device_id dw_dma_acpi_id_table[] = { - {"INTL9C60" , (kernel_ulong_t)&dw_dma_chip_pdata }, - {"80862286" , (kernel_ulong_t)&dw_dma_chip_pdata }, - {"808622C0" , (kernel_ulong_t)&dw_dma_chip_pdata }, + { .id ="INTL9C60" , .driver_data = (kernel_ulong_t)&dw_dma_chip_pdata }, + { .id ="80862286" , .driver_data = (kernel_ulong_t)&dw_dma_chip_pdata }, + { .id ="808622C0" , .driver_data = (kernel_ulong_t)&dw_dma_chip_pdata },/* Elkhart Lake iDMA 32-bit (PSE DMA) */ - {"80864BB4" , (kernel_ulong_t)&xbar_chip_pdata }, - {"80864BB5" , (kernel_ulong_t)&xbar_chip_pdata }, - {"80864BB6" , (kernel_ulong_t)&xbar_chip_pdata }, + { .id ="80864BB4" , .driver_data = (kernel_ulong_t)&xbar_chip_pdata }, + { .id ="80864BB5" , .driver_data = (kernel_ulong_t)&xbar_chip_pdata }, + { .id ="80864BB6" , .driver_data = (kernel_ulong_t)&xbar_chip_pdata }, { } };
Signature · 1 line
2.43.0
PATCH v3 2/4 dmaengine: loongson: use named initializers for acpi_device_id
In reply to Pawel ZalewskiUse a named 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.
--- drivers/dma/loongson/loongson2-apb-cmc-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/loongson/loongson2-apb-cmc-dma.c +2 -2
@@ -709,8 +709,8 @@ static const struct of_device_id loongson2_cmc_dma_of_match[] = {MODULE_DEVICE_TABLE (of, loongson2_cmc_dma_of_match);static const struct acpi_device_id loongson2_cmc_dma_acpi_match[] = { - {"LOON0014" , .driver_data = (kernel_ulong_t)&ls2k3000_cmc_dma_config }, - {/* sentinel */ } + { .id ="LOON0014" , .driver_data = (kernel_ulong_t)&ls2k3000_cmc_dma_config }, + { } };MODULE_DEVICE_TABLE (acpi, loongson2_cmc_dma_acpi_match);
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v3 2/4] dmaengine: loongson: use named initializers for acpi_device_id
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dmaengine: loongson: incomplete unification of list terminators --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dmaengine: loongson: incomplete unification of list terminators
--
commit 4321a78607f15fa601095e26975f8fbd9cdea572
Author: Pawel Zalewski <[email protected]>
dmaengine: loongson: use named initializers for acpi_device_id
Use a named 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.
drivers/dma/loongson/loongson2-apb-cmc-dma.c static const struct of_device_id loongson2_cmc_dma_of_match[] = { · line 713
Quoted 12 lines
drivers/dma/loongson/loongson2-apb-cmc-dma.c +2
-2@@ -709,8 +709,8 @@ static const struct of_device_id loongson2_cmc_dma_of_match[] = {MODULE_DEVICE_TABLE (of, loongson2_cmc_dma_of_match);static const struct acpi_device_id loongson2_cmc_dma_acpi_match[] = { - {"LOON0014" , .driver_data = (kernel_ulong_t)&ls2k3000_cmc_dma_config }, - {/* sentinel */ } + { .id ="LOON0014" , .driver_data = (kernel_ulong_t)&ls2k3000_cmc_dma_config }, + { }
[Severity: Low]
The commit message mentions unifying the list terminator, but does this miss the OF match table located immediately above?
drivers/dma/loongson/loongson2-apb-cmc-dma.c:
static const struct of_device_id loongson2_cmc_dma_of_match[] = {
...
{ .compatible = "loongson,ls2k3000-dma", .data = &ls2k3000_cmc_dma_config },
{ /* sentinel */ }
};Should the list terminator here also be updated for consistency?
Quoted 2 lines
drivers/dma/loongson/loongson2-apb-cmc-dma.c +0
-0};MODULE_DEVICE_TABLE (acpi, loongson2_cmc_dma_acpi_match);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v3 2/4] dmaengine: loongson: use named initializers for acpi_device_id
In reply to Pawel ZalewskiQuoted 11 lines · Pawel Zalewski
Use a named initializer for the
acpi_device_idfields 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 <[email protected]>Reviewed-by Binbin Zhou <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
Quoted 22 lines
drivers/dma/loongson/loongson2-apb-cmc-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/loongson/loongson2-apb-cmc-dma.c +2
-3@@ -709,8 +709,8 @@ static const struct of_device_id loongson2_cmc_dma_of_match[] = {MODULE_DEVICE_TABLE (of, loongson2_cmc_dma_of_match);static const struct acpi_device_id loongson2_cmc_dma_acpi_match[] = { - {"LOON0014" , .driver_data = (kernel_ulong_t)&ls2k3000_cmc_dma_config }, - {/* sentinel */ } + { .id ="LOON0014" , .driver_data = (kernel_ulong_t)&ls2k3000_cmc_dma_config }, + { } };MODULE_DEVICE_TABLE (acpi, loongson2_cmc_dma_acpi_match); --2.43.0
PATCH v3 3/4 dmaengine: qcom: use named initializers for acpi_device_id
In reply to Pawel ZalewskiUse a named 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.
--- drivers/dma/qcom/hidma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/dma/qcom/hidma.c +4 -4
@@ -935,10 +935,10 @@ static void hidma_remove(struct platform_device *pdev)#if IS_ENABLED (CONFIG_ACPI )static const struct acpi_device_id hidma_acpi_ids[] = { - {"QCOM8061" }, - {"QCOM8062" ,HIDMA_MSI_CAP }, - {"QCOM8063" , (HIDMA_MSI_CAP |HIDMA_IDENTITY_CAP )}, - {}, + { .id ="QCOM8061" }, + { .id ="QCOM8062" , .driver_data =HIDMA_MSI_CAP }, + { .id ="QCOM8063" , .driver_data = (HIDMA_MSI_CAP |HIDMA_IDENTITY_CAP ) }, + { } };MODULE_DEVICE_TABLE (acpi, hidma_acpi_ids);#endif
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v3 3/4] dmaengine: qcom: use named initializers for acpi_device_id
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dmaengine: qcom: incomplete named initializer transition in hidma_mgmt.c --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dmaengine: qcom: incomplete named initializer transition in hidma_mgmt.c --
commit 9a66310e86b837e8fbd5ab6a856a4abdb2bbb6cd
Author: Pawel Zalewski <[email protected]>
dmaengine: qcom: use named initializers for acpi_device_id
Use a named 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.
Quoted 7 lines
drivers/dma/qcom/hidma.c +0
-0@@ -935,10 +935,10 @@ static void hidma_remove(struct platform_device *pdev)#if IS_ENABLED (CONFIG_ACPI )
drivers/dma/qcom/hidma.c static void hidma_remove(struct platform_device *pdev) · line 942
Quoted 10 lines
drivers/dma/qcom/hidma.c +4
-4static const struct acpi_device_id hidma_acpi_ids[] = { - {"QCOM8061" }, - {"QCOM8062" ,HIDMA_MSI_CAP }, - {"QCOM8063" , (HIDMA_MSI_CAP |HIDMA_IDENTITY_CAP )}, - {}, + { .id ="QCOM8061" }, + { .id ="QCOM8062" , .driver_data =HIDMA_MSI_CAP }, + { .id ="QCOM8063" , .driver_data = (HIDMA_MSI_CAP |HIDMA_IDENTITY_CAP ) }, + { } };
[Severity: Low]
This isn't a bug, but did this commit miss updating a similar struct in the same module directory?
drivers/dma/qcom/hidma_mgmt.c:hidma_mgmt_acpi_ids:
static const struct acpi_device_id hidma_mgmt_acpi_ids[] = {
{"QCOM8060"},
{},
};This struct follows the exact same pattern, but was missed by the cleanup, leading to inconsistent coding styles within the same directory.
Quoted 2 lines
drivers/dma/qcom/hidma.c +0
-0MODULE_DEVICE_TABLE (acpi, hidma_acpi_ids);#endif
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH v3 3/4] dmaengine: qcom: use named initializers for acpi_device_id
In reply to Pawel ZalewskiQuoted 10 lines · Pawel Zalewski
Use a named initializer for the
acpi_device_idfields 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 <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
Quoted 26 lines
drivers/dma/qcom/hidma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/dma/qcom/hidma.c +4
-5@@ -935,10 +935,10 @@ static void hidma_remove(struct platform_device *pdev)#if IS_ENABLED (CONFIG_ACPI )static const struct acpi_device_id hidma_acpi_ids[] = { - {"QCOM8061" }, - {"QCOM8062" ,HIDMA_MSI_CAP }, - {"QCOM8063" , (HIDMA_MSI_CAP |HIDMA_IDENTITY_CAP )}, - {}, + { .id ="QCOM8061" }, + { .id ="QCOM8062" , .driver_data =HIDMA_MSI_CAP }, + { .id ="QCOM8063" , .driver_data = (HIDMA_MSI_CAP |HIDMA_IDENTITY_CAP ) }, + { } };MODULE_DEVICE_TABLE (acpi, hidma_acpi_ids);#endif --2.43.0
PATCH v3 4/4 dmaengine: xgene-dma: use named initializers for acpi_device_id
In reply to Pawel ZalewskiUse 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.
--- drivers/dma/xgene-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/xgene-dma.c +2 -2
@@ -1800,8 +1800,8 @@ static void xgene_dma_remove(struct platform_device *pdev)#ifdef CONFIG_ACPI static const struct acpi_device_id xgene_dma_acpi_match_ptr[] = { - {"APMC0D43" ,0 }, - {}, + { .id ="APMC0D43" }, + { } };MODULE_DEVICE_TABLE (acpi, xgene_dma_acpi_match_ptr);#endif
Signature · 1 line
2.43.0
Re: [PATCH v3 4/4] dmaengine: xgene-dma: use named initializers for acpi_device_id
Quoted 11 lines · Pawel Zalewski
Use a designated initializer for the
acpi_device_idfields 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.
Signed-off-by Pawel Zalewski <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
Quoted 22 lines
drivers/dma/xgene-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/xgene-dma.c +2
-3@@ -1800,8 +1800,8 @@ static void xgene_dma_remove(struct platform_device *pdev)#ifdef CONFIG_ACPI static const struct acpi_device_id xgene_dma_acpi_match_ptr[] = { - {"APMC0D43" ,0 }, - {}, + { .id ="APMC0D43" }, + { } };MODULE_DEVICE_TABLE (acpi, xgene_dma_acpi_match_ptr);#endif --2.43.0
Quoted 11 lines · Pawel Zalewski
This series is converting lists that contain the
acpi_device_idstruct, which is defined in theinclude/linux/device-id/acpi.hto 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_datato 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:[...]
Applied, thanks!
[1/4] dmaengine: dw: use designated initializers for acpi_device_id
commit: 3a03a5866e82027c0fa96f6208721397e5a6ff78
[2/4] dmaengine: loongson: use named initializers for acpi_device_id
commit: b37c93bc1cfd0f5fb898b7943bd0c1797341a41d
[3/4] dmaengine: qcom: use named initializers for acpi_device_id
commit: db09763394959442d91d86840717412073c41abc
[4/4] dmaengine: xgene-dma: use named initializers for acpi_device_id
commit: b2c203a5878b0d3f95e4802fa01e320d317b82cfBest regards,
Signature · 1 line
~Vinod