* [PATCH] mfd: Use named initializers for acpi_device_id
@ 2026-11-02 12:25 Pawel Zalewski
2026-11-02 14:26 ` Charles Keepax
0 siblings, 1 reply; 2+ messages in thread
From: Pawel Zalewski @ 2026-11-02 12:25 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai, David Rhodes, Richard Fitzgerald,
Andy Shevchenko, Mika Westerberg, Zha Qipeng, Qunqin Zhao,
Thomas Richard
Cc: mfd, linux-kernel, linux-sound, patches, linux-crypto, Pawel Zalewski
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.
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.
[1] https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/
---
drivers/mfd/axp20x-i2c.c | 2 +-
drivers/mfd/cs42l43-i2c.c | 8 ++---
drivers/mfd/intel-lpss-acpi.c | 58 +++++++++++++++++------------------
drivers/mfd/intel_pmc_bxt.c | 2 +-
drivers/mfd/intel_soc_pmic_bxtwc.c | 2 +-
drivers/mfd/intel_soc_pmic_chtdc_ti.c | 4 +--
drivers/mfd/intel_soc_pmic_chtwc.c | 2 +-
drivers/mfd/intel_soc_pmic_crc.c | 4 +--
drivers/mfd/intel_soc_pmic_mrfld.c | 4 +--
drivers/mfd/kempld-core.c | 6 ++--
drivers/mfd/loongson-se.c | 2 +-
drivers/mfd/upboard-fpga.c | 6 ++--
12 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
index 5c93136f977e..c5d0d35c7fb0 100644
--- a/drivers/mfd/axp20x-i2c.c
+++ b/drivers/mfd/axp20x-i2c.c
@@ -97,7 +97,7 @@ static const struct acpi_device_id axp20x_i2c_acpi_match[] = {
.id = "INT33F4",
.driver_data = AXP288_ID,
},
- { },
+ { }
};
MODULE_DEVICE_TABLE(acpi, axp20x_i2c_acpi_match);
#endif
diff --git a/drivers/mfd/cs42l43-i2c.c b/drivers/mfd/cs42l43-i2c.c
index 2f1862199618..89dca295cc57 100644
--- a/drivers/mfd/cs42l43-i2c.c
+++ b/drivers/mfd/cs42l43-i2c.c
@@ -73,10 +73,10 @@ MODULE_DEVICE_TABLE(of, cs42l43_of_match);
#if IS_ENABLED(CONFIG_ACPI)
static const struct acpi_device_id cs42l43_acpi_match[] = {
- { "CSC4243", CS42L43_DEVID_VAL },
- { "CSC2A3B", CS42L43B_DEVID_VAL },
- { "CSC4244", CS42L43B_DEVID_VAL },
- {}
+ { .id = "CSC4243", .driver_data = CS42L43_DEVID_VAL },
+ { .id = "CSC2A3B", .driver_data = CS42L43B_DEVID_VAL },
+ { .id = "CSC4244", .driver_data = CS42L43B_DEVID_VAL },
+ { }
};
MODULE_DEVICE_TABLE(acpi, cs42l43_acpi_match);
#endif
diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 720adb0ee21f..2f46a85066bd 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -137,38 +137,38 @@ static const struct intel_lpss_platform_info cnl_i2c_info = {
static const struct acpi_device_id intel_lpss_acpi_ids[] = {
/* SPT */
- { "INT3440", (kernel_ulong_t)&spt_info },
- { "INT3441", (kernel_ulong_t)&spt_info },
- { "INT3442", (kernel_ulong_t)&spt_i2c_info },
- { "INT3443", (kernel_ulong_t)&spt_i2c_info },
- { "INT3444", (kernel_ulong_t)&spt_i2c_info },
- { "INT3445", (kernel_ulong_t)&spt_i2c_info },
- { "INT3446", (kernel_ulong_t)&spt_i2c_info },
- { "INT3447", (kernel_ulong_t)&spt_i2c_info },
- { "INT3448", (kernel_ulong_t)&spt_uart_info },
- { "INT3449", (kernel_ulong_t)&spt_uart_info },
- { "INT344A", (kernel_ulong_t)&spt_uart_info },
+ { .id = "INT3440", .driver_data = (kernel_ulong_t)&spt_info },
+ { .id = "INT3441", .driver_data = (kernel_ulong_t)&spt_info },
+ { .id = "INT3442", .driver_data = (kernel_ulong_t)&spt_i2c_info },
+ { .id = "INT3443", .driver_data = (kernel_ulong_t)&spt_i2c_info },
+ { .id = "INT3444", .driver_data = (kernel_ulong_t)&spt_i2c_info },
+ { .id = "INT3445", .driver_data = (kernel_ulong_t)&spt_i2c_info },
+ { .id = "INT3446", .driver_data = (kernel_ulong_t)&spt_i2c_info },
+ { .id = "INT3447", .driver_data = (kernel_ulong_t)&spt_i2c_info },
+ { .id = "INT3448", .driver_data = (kernel_ulong_t)&spt_uart_info },
+ { .id = "INT3449", .driver_data = (kernel_ulong_t)&spt_uart_info },
+ { .id = "INT344A", .driver_data = (kernel_ulong_t)&spt_uart_info },
/* CNL */
- { "INT34B0", (kernel_ulong_t)&cnl_info },
- { "INT34B1", (kernel_ulong_t)&cnl_info },
- { "INT34B2", (kernel_ulong_t)&cnl_i2c_info },
- { "INT34B3", (kernel_ulong_t)&cnl_i2c_info },
- { "INT34B4", (kernel_ulong_t)&cnl_i2c_info },
- { "INT34B5", (kernel_ulong_t)&cnl_i2c_info },
- { "INT34B6", (kernel_ulong_t)&cnl_i2c_info },
- { "INT34B7", (kernel_ulong_t)&cnl_i2c_info },
- { "INT34B8", (kernel_ulong_t)&spt_uart_info },
- { "INT34B9", (kernel_ulong_t)&spt_uart_info },
- { "INT34BA", (kernel_ulong_t)&spt_uart_info },
- { "INT34BC", (kernel_ulong_t)&cnl_info },
+ { .id = "INT34B0", .driver_data = (kernel_ulong_t)&cnl_info },
+ { .id = "INT34B1", .driver_data = (kernel_ulong_t)&cnl_info },
+ { .id = "INT34B2", .driver_data = (kernel_ulong_t)&cnl_i2c_info },
+ { .id = "INT34B3", .driver_data = (kernel_ulong_t)&cnl_i2c_info },
+ { .id = "INT34B4", .driver_data = (kernel_ulong_t)&cnl_i2c_info },
+ { .id = "INT34B5", .driver_data = (kernel_ulong_t)&cnl_i2c_info },
+ { .id = "INT34B6", .driver_data = (kernel_ulong_t)&cnl_i2c_info },
+ { .id = "INT34B7", .driver_data = (kernel_ulong_t)&cnl_i2c_info },
+ { .id = "INT34B8", .driver_data = (kernel_ulong_t)&spt_uart_info },
+ { .id = "INT34B9", .driver_data = (kernel_ulong_t)&spt_uart_info },
+ { .id = "INT34BA", .driver_data = (kernel_ulong_t)&spt_uart_info },
+ { .id = "INT34BC", .driver_data = (kernel_ulong_t)&cnl_info },
/* BXT */
- { "80860AAC", (kernel_ulong_t)&bxt_i2c_info },
- { "80860ABC", (kernel_ulong_t)&bxt_info },
- { "80860AC2", (kernel_ulong_t)&bxt_info },
+ { .id = "80860AAC", .driver_data = (kernel_ulong_t)&bxt_i2c_info },
+ { .id = "80860ABC", .driver_data = (kernel_ulong_t)&bxt_info },
+ { .id = "80860AC2", .driver_data = (kernel_ulong_t)&bxt_info },
/* APL */
- { "80865AAC", (kernel_ulong_t)&apl_i2c_info },
- { "80865ABC", (kernel_ulong_t)&bxt_info },
- { "80865AC2", (kernel_ulong_t)&bxt_info },
+ { .id = "80865AAC", .driver_data = (kernel_ulong_t)&apl_i2c_info },
+ { .id = "80865ABC", .driver_data = (kernel_ulong_t)&bxt_info },
+ { .id = "80865AC2", .driver_data = (kernel_ulong_t)&bxt_info },
{ }
};
MODULE_DEVICE_TABLE(acpi, intel_lpss_acpi_ids);
diff --git a/drivers/mfd/intel_pmc_bxt.c b/drivers/mfd/intel_pmc_bxt.c
index e405d7513ca1..6a9ad1f135c7 100644
--- a/drivers/mfd/intel_pmc_bxt.c
+++ b/drivers/mfd/intel_pmc_bxt.c
@@ -414,7 +414,7 @@ static int intel_pmc_create_devices(struct intel_pmc_dev *pmc)
}
static const struct acpi_device_id intel_pmc_acpi_ids[] = {
- { "INT34D2" },
+ { .id = "INT34D2" },
{ }
};
MODULE_DEVICE_TABLE(acpi, intel_pmc_acpi_ids);
diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
index 117517c171b5..08fedf3d3fee 100644
--- a/drivers/mfd/intel_soc_pmic_bxtwc.c
+++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
@@ -606,7 +606,7 @@ static int bxtwc_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume);
static const struct acpi_device_id bxtwc_acpi_ids[] = {
- { "INT34D3", },
+ { .id = "INT34D3" },
{ }
};
MODULE_DEVICE_TABLE(acpi, bxtwc_acpi_ids);
diff --git a/drivers/mfd/intel_soc_pmic_chtdc_ti.c b/drivers/mfd/intel_soc_pmic_chtdc_ti.c
index 6daf33e07ea0..49f4138961c8 100644
--- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c
+++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c
@@ -162,8 +162,8 @@ static int chtdc_ti_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(chtdc_ti_pm_ops, chtdc_ti_suspend, chtdc_ti_resume);
static const struct acpi_device_id chtdc_ti_acpi_ids[] = {
- { "INT33F5" },
- { },
+ { .id = "INT33F5" },
+ { }
};
MODULE_DEVICE_TABLE(acpi, chtdc_ti_acpi_ids);
diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c b/drivers/mfd/intel_soc_pmic_chtwc.c
index aa71a7d83fcd..413d2fd4f86a 100644
--- a/drivers/mfd/intel_soc_pmic_chtwc.c
+++ b/drivers/mfd/intel_soc_pmic_chtwc.c
@@ -261,7 +261,7 @@ static const struct i2c_device_id cht_wc_i2c_id[] = {
};
static const struct acpi_device_id cht_wc_acpi_ids[] = {
- { "INT34D3", },
+ { .id = "INT34D3" },
{ }
};
diff --git a/drivers/mfd/intel_soc_pmic_crc.c b/drivers/mfd/intel_soc_pmic_crc.c
index 627a89334908..d39f73ae6773 100644
--- a/drivers/mfd/intel_soc_pmic_crc.c
+++ b/drivers/mfd/intel_soc_pmic_crc.c
@@ -252,8 +252,8 @@ static int crystal_cove_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(crystal_cove_pm_ops, crystal_cove_suspend, crystal_cove_resume);
static const struct acpi_device_id crystal_cove_acpi_match[] = {
- { "INT33FD" },
- { },
+ { .id = "INT33FD" },
+ { }
};
MODULE_DEVICE_TABLE(acpi, crystal_cove_acpi_match);
diff --git a/drivers/mfd/intel_soc_pmic_mrfld.c b/drivers/mfd/intel_soc_pmic_mrfld.c
index 77121775c1a3..531d8b8be44d 100644
--- a/drivers/mfd/intel_soc_pmic_mrfld.c
+++ b/drivers/mfd/intel_soc_pmic_mrfld.c
@@ -139,8 +139,8 @@ static int bcove_probe(struct platform_device *pdev)
}
static const struct acpi_device_id bcove_acpi_ids[] = {
- { "INTC100E" },
- {}
+ { .id = "INTC100E" },
+ { }
};
MODULE_DEVICE_TABLE(acpi, bcove_acpi_ids);
diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
index 47062f876e5d..399f1c97320c 100644
--- a/drivers/mfd/kempld-core.c
+++ b/drivers/mfd/kempld-core.c
@@ -470,9 +470,9 @@ static void kempld_remove(struct platform_device *pdev)
}
static const struct acpi_device_id kempld_acpi_table[] = {
- { "KEM0000", (kernel_ulong_t)&kempld_platform_data_generic },
- { "KEM0001", (kernel_ulong_t)&kempld_platform_data_generic },
- {}
+ { .id = "KEM0000", .driver_data = (kernel_ulong_t)&kempld_platform_data_generic },
+ { .id = "KEM0001", .driver_data = (kernel_ulong_t)&kempld_platform_data_generic },
+ { }
};
MODULE_DEVICE_TABLE(acpi, kempld_acpi_table);
diff --git a/drivers/mfd/loongson-se.c b/drivers/mfd/loongson-se.c
index 3902ba377d69..49a95b8e4ca3 100644
--- a/drivers/mfd/loongson-se.c
+++ b/drivers/mfd/loongson-se.c
@@ -233,7 +233,7 @@ static int loongson_se_probe(struct platform_device *pdev)
}
static const struct acpi_device_id loongson_se_acpi_match[] = {
- { "LOON0011", 0 },
+ { .id = "LOON0011" },
{ }
};
MODULE_DEVICE_TABLE(acpi, loongson_se_acpi_match);
diff --git a/drivers/mfd/upboard-fpga.c b/drivers/mfd/upboard-fpga.c
index 9a9599dcb0a1..37c3c50aa6e4 100644
--- a/drivers/mfd/upboard-fpga.c
+++ b/drivers/mfd/upboard-fpga.c
@@ -300,9 +300,9 @@ static int upboard_fpga_probe(struct platform_device *pdev)
}
static const struct acpi_device_id upboard_fpga_acpi_match[] = {
- { "AANT0F01", (kernel_ulong_t)&upboard_up2_fpga_data },
- { "AANT0F04", (kernel_ulong_t)&upboard_up_fpga_data },
- {}
+ { .id = "AANT0F01", .driver_data = (kernel_ulong_t)&upboard_up2_fpga_data },
+ { .id = "AANT0F04", .driver_data = (kernel_ulong_t)&upboard_up_fpga_data },
+ { }
};
MODULE_DEVICE_TABLE(acpi, upboard_fpga_acpi_match);
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261030-acpi-mfd-a6ac9d16671b
Best regards,
--
Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: Use named initializers for acpi_device_id
2026-11-02 12:25 [PATCH] mfd: Use named initializers for acpi_device_id Pawel Zalewski
@ 2026-11-02 14:26 ` Charles Keepax
0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2026-11-02 14:26 UTC (permalink / raw)
To: Pawel Zalewski
Cc: Lee Jones, Chen-Yu Tsai, David Rhodes, Richard Fitzgerald,
Andy Shevchenko, Mika Westerberg, Zha Qipeng, Qunqin Zhao,
Thomas Richard, mfd, linux-kernel, linux-sound, patches,
linux-crypto
On Mon, Nov 02, 2026 at 12:25:14PM +0000, 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. 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 <pzalewski@thegoodpenguin.co.uk>
> ---
> drivers/mfd/cs42l43-i2c.c | 8 ++---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-02 14:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 12:25 [PATCH] mfd: Use named initializers for acpi_device_id Pawel Zalewski
2026-11-02 14:26 ` Charles Keepax
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®