[PATCH v2 11/23] mfd: Use named initializers for acpi_device_id arrays

From: Uwe Kleine-König (The Capable Hub)

Date: Wed Jul 08 2026 - 07:23:48 EST


While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

The mentioned robustness is relevant for a planned change to struct
acpi_device_id that replaces .driver_data by an anonymous union.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
---
drivers/mfd/cs42l43-i2c.c | 4 +-
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 | 2 +-
drivers/mfd/intel_soc_pmic_chtwc.c | 2 +-
drivers/mfd/intel_soc_pmic_crc.c | 2 +-
drivers/mfd/intel_soc_pmic_mrfld.c | 2 +-
drivers/mfd/kempld-core.c | 4 +-
drivers/mfd/loongson-se.c | 2 +-
drivers/mfd/upboard-fpga.c | 4 +-
11 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/mfd/cs42l43-i2c.c b/drivers/mfd/cs42l43-i2c.c
index cbe05c3ea910..e9cb4fb9854a 100644
--- a/drivers/mfd/cs42l43-i2c.c
+++ b/drivers/mfd/cs42l43-i2c.c
@@ -65,8 +65,8 @@ 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 },
+ { .id = "CSC4243", .driver_data = CS42L43_DEVID_VAL },
+ { .id = "CSC2A3B", .driver_data = CS42L43B_DEVID_VAL },
{}
};
MODULE_DEVICE_TABLE(acpi, cs42l43_acpi_match);
diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index d4b24a717848..19fc36164d89 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -135,38 +135,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..ff6223d6f54b 100644
--- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c
+++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c
@@ -162,7 +162,7 @@ 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..d3db727c08de 100644
--- a/drivers/mfd/intel_soc_pmic_crc.c
+++ b/drivers/mfd/intel_soc_pmic_crc.c
@@ -252,7 +252,7 @@ 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..9d7e1881d693 100644
--- a/drivers/mfd/intel_soc_pmic_mrfld.c
+++ b/drivers/mfd/intel_soc_pmic_mrfld.c
@@ -139,7 +139,7 @@ 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 e60736380cfe..bf02189b9a70 100644
--- a/drivers/mfd/kempld-core.c
+++ b/drivers/mfd/kempld-core.c
@@ -467,8 +467,8 @@ static void kempld_remove(struct platform_device *pdev)
}

static const struct acpi_device_id kempld_acpi_table[] = {
- { "KEM0000" },
- { "KEM0001" },
+ { .id = "KEM0000" },
+ { .id = "KEM0001" },
{}
};
MODULE_DEVICE_TABLE(acpi, kempld_acpi_table);
diff --git a/drivers/mfd/loongson-se.c b/drivers/mfd/loongson-se.c
index 4c668e2d2241..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" },
+ { .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..6674f4a1d2fe 100644
--- a/drivers/mfd/upboard-fpga.c
+++ b/drivers/mfd/upboard-fpga.c
@@ -300,8 +300,8 @@ 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);
--
2.55.0.11.g153666a7d9bb