[PATCH v2 12/21] gpio: Use named initializers for acpi_device_id array
From: Uwe Kleine-König (The Capable Hub)
Date: Wed Jul 15 2026 - 12:59:16 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/gpio/gpio-amdpt.c | 6 +++---
drivers/gpio/gpio-dwapb.c | 10 +++++-----
drivers/gpio/gpio-graniterapids.c | 2 +-
drivers/gpio/gpio-hisi.c | 2 +-
drivers/gpio/gpio-mb86s7x.c | 2 +-
drivers/gpio/gpio-mlxbf3.c | 2 +-
drivers/gpio/gpio-mpc8xxx.c | 2 +-
drivers/gpio/gpio-novalake-events.c | 2 +-
drivers/gpio/gpio-pca953x.c | 2 +-
drivers/gpio/gpio-usbio.c | 12 ++++++------
drivers/gpio/gpio-xgene-sb.c | 2 +-
drivers/gpio/gpio-xgene.c | 2 +-
drivers/gpio/gpio-xlp.c | 4 ++--
13 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/gpio/gpio-amdpt.c b/drivers/gpio/gpio-amdpt.c
index 8458a6949c65..32c4d0ee8101 100644
--- a/drivers/gpio/gpio-amdpt.c
+++ b/drivers/gpio/gpio-amdpt.c
@@ -125,9 +125,9 @@ static int pt_gpio_probe(struct platform_device *pdev)
}
static const struct acpi_device_id pt_gpio_acpi_match[] = {
- { "AMDF030", PT_TOTAL_GPIO },
- { "AMDIF030", PT_TOTAL_GPIO },
- { "AMDIF031", PT_TOTAL_GPIO_EX },
+ { .id = "AMDF030", .driver_data = PT_TOTAL_GPIO },
+ { .id = "AMDIF030", .driver_data = PT_TOTAL_GPIO },
+ { .id = "AMDIF031", .driver_data = PT_TOTAL_GPIO_EX },
{ },
};
MODULE_DEVICE_TABLE(acpi, pt_gpio_acpi_match);
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index aa7c08e60707..e159c3f98f1c 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -720,11 +720,11 @@ static const struct of_device_id dwapb_of_match[] = {
MODULE_DEVICE_TABLE(of, dwapb_of_match);
static const struct acpi_device_id dwapb_acpi_match[] = {
- {"HISI0181", GPIO_REG_OFFSET_V1},
- {"APMC0D07", GPIO_REG_OFFSET_V1},
- {"APMC0D81", GPIO_REG_OFFSET_V2},
- {"FUJI200A", GPIO_REG_OFFSET_V1},
- {"LECA0001", GPIO_REG_OFFSET_V1},
+ { .id = "HISI0181", .driver_data = GPIO_REG_OFFSET_V1 },
+ { .id = "APMC0D07", .driver_data = GPIO_REG_OFFSET_V1 },
+ { .id = "APMC0D81", .driver_data = GPIO_REG_OFFSET_V2 },
+ { .id = "FUJI200A", .driver_data = GPIO_REG_OFFSET_V1 },
+ { .id = "LECA0001", .driver_data = GPIO_REG_OFFSET_V1 },
{ }
};
MODULE_DEVICE_TABLE(acpi, dwapb_acpi_match);
diff --git a/drivers/gpio/gpio-graniterapids.c b/drivers/gpio/gpio-graniterapids.c
index 2d0fe3abd5e0..6a77a5864d09 100644
--- a/drivers/gpio/gpio-graniterapids.c
+++ b/drivers/gpio/gpio-graniterapids.c
@@ -394,7 +394,7 @@ static int gnr_gpio_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(gnr_gpio_pm_ops, gnr_gpio_suspend, gnr_gpio_resume);
static const struct acpi_device_id gnr_gpio_acpi_match[] = {
- { "INTC1109" },
+ { .id = "INTC1109" },
{}
};
MODULE_DEVICE_TABLE(acpi, gnr_gpio_acpi_match);
diff --git a/drivers/gpio/gpio-hisi.c b/drivers/gpio/gpio-hisi.c
index 3b65ed4592ee..1a89695ce515 100644
--- a/drivers/gpio/gpio-hisi.c
+++ b/drivers/gpio/gpio-hisi.c
@@ -222,7 +222,7 @@ static void hisi_gpio_init_irq(struct hisi_gpio *hisi_gpio)
}
static const struct acpi_device_id hisi_gpio_acpi_match[] = {
- { "HISI0184" },
+ { .id = "HISI0184" },
{}
};
MODULE_DEVICE_TABLE(acpi, hisi_gpio_acpi_match);
diff --git a/drivers/gpio/gpio-mb86s7x.c b/drivers/gpio/gpio-mb86s7x.c
index 78bcae130e0e..58915ffb4bfe 100644
--- a/drivers/gpio/gpio-mb86s7x.c
+++ b/drivers/gpio/gpio-mb86s7x.c
@@ -213,7 +213,7 @@ MODULE_DEVICE_TABLE(of, mb86s70_gpio_dt_ids);
#ifdef CONFIG_ACPI
static const struct acpi_device_id mb86s70_gpio_acpi_ids[] = {
- { "SCX0007" },
+ { .id = "SCX0007" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, mb86s70_gpio_acpi_ids);
diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c
index 7d747958f2bc..99b880596330 100644
--- a/drivers/gpio/gpio-mlxbf3.c
+++ b/drivers/gpio/gpio-mlxbf3.c
@@ -271,7 +271,7 @@ static void mlxbf3_gpio_shutdown(struct platform_device *pdev)
}
static const struct acpi_device_id mlxbf3_gpio_acpi_match[] = {
- { "MLNXBF33" },
+ { .id = "MLNXBF33" },
{}
};
MODULE_DEVICE_TABLE(acpi, mlxbf3_gpio_acpi_match);
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index ee35da06cbc7..e79312a7d5a4 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -486,7 +486,7 @@ static DEFINE_RUNTIME_DEV_PM_OPS(mpc8xx_pm_ops,
#ifdef CONFIG_ACPI
static const struct acpi_device_id gpio_acpi_ids[] = {
- {"NXP0031",},
+ { .id = "NXP0031" },
{ }
};
MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids);
diff --git a/drivers/gpio/gpio-novalake-events.c b/drivers/gpio/gpio-novalake-events.c
index b3bf0038f84a..d5a3bd48bed3 100644
--- a/drivers/gpio/gpio-novalake-events.c
+++ b/drivers/gpio/gpio-novalake-events.c
@@ -304,7 +304,7 @@ static int nvl_gpio_probe(struct platform_device *pdev)
}
static const struct acpi_device_id nvl_gpio_acpi_match[] = {
- { "INTC1114" },
+ { .id = "INTC1114" },
{}
};
MODULE_DEVICE_TABLE(acpi, nvl_gpio_acpi_match);
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index f6b870b7b352..918cadc2db07 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -180,7 +180,7 @@ static const struct dmi_system_id pca953x_dmi_acpi_irq_info[] = {
#endif
static const struct acpi_device_id pca953x_acpi_ids[] = {
- { "INT3491", 16 | PCA953X_TYPE | PCA_LATCH_INT, },
+ { .id = "INT3491", .driver_data = 16 | PCA953X_TYPE | PCA_LATCH_INT },
{ }
};
MODULE_DEVICE_TABLE(acpi, pca953x_acpi_ids);
diff --git a/drivers/gpio/gpio-usbio.c b/drivers/gpio/gpio-usbio.c
index 614523d461fe..3a34b9ac3248 100644
--- a/drivers/gpio/gpio-usbio.c
+++ b/drivers/gpio/gpio-usbio.c
@@ -26,12 +26,12 @@ struct usbio_gpio {
};
static const struct acpi_device_id usbio_gpio_acpi_hids[] = {
- { "INTC1007" }, /* MTL */
- { "INTC10B2" }, /* ARL */
- { "INTC10B5" }, /* LNL */
- { "INTC10D1" }, /* MTL-CVF */
- { "INTC10E2" }, /* PTL */
- { "INTC1116" }, /* NVL */
+ { .id = "INTC1007" }, /* MTL */
+ { .id = "INTC10B2" }, /* ARL */
+ { .id = "INTC10B5" }, /* LNL */
+ { .id = "INTC10D1" }, /* MTL-CVF */
+ { .id = "INTC10E2" }, /* PTL */
+ { .id = "INTC1116" }, /* NVL */
{ }
};
MODULE_DEVICE_TABLE(acpi, usbio_gpio_acpi_hids);
diff --git a/drivers/gpio/gpio-xgene-sb.c b/drivers/gpio/gpio-xgene-sb.c
index 3675456b1e9b..6f2907468507 100644
--- a/drivers/gpio/gpio-xgene-sb.c
+++ b/drivers/gpio/gpio-xgene-sb.c
@@ -339,7 +339,7 @@ static const struct of_device_id xgene_gpio_sb_of_match[] = {
MODULE_DEVICE_TABLE(of, xgene_gpio_sb_of_match);
static const struct acpi_device_id xgene_gpio_sb_acpi_match[] = {
- { "APMC0D15" },
+ { .id = "APMC0D15" },
{}
};
MODULE_DEVICE_TABLE(acpi, xgene_gpio_sb_acpi_match);
diff --git a/drivers/gpio/gpio-xgene.c b/drivers/gpio/gpio-xgene.c
index b34b0c58b67c..84c1cc165024 100644
--- a/drivers/gpio/gpio-xgene.c
+++ b/drivers/gpio/gpio-xgene.c
@@ -195,7 +195,7 @@ MODULE_DEVICE_TABLE(of, xgene_gpio_of_match);
#ifdef CONFIG_ACPI
static const struct acpi_device_id xgene_gpio_acpi_match[] = {
- { "APMC0D14" },
+ { .id = "APMC0D14" },
{ },
};
MODULE_DEVICE_TABLE(acpi, xgene_gpio_acpi_match);
diff --git a/drivers/gpio/gpio-xlp.c b/drivers/gpio/gpio-xlp.c
index aede6324387f..50625f98f8e2 100644
--- a/drivers/gpio/gpio-xlp.c
+++ b/drivers/gpio/gpio-xlp.c
@@ -304,8 +304,8 @@ static int xlp_gpio_probe(struct platform_device *pdev)
#ifdef CONFIG_ACPI
static const struct acpi_device_id xlp_gpio_acpi_match[] = {
- { "BRCM9006" },
- { "CAV9006" },
+ { .id = "BRCM9006" },
+ { .id = "CAV9006" },
{},
};
MODULE_DEVICE_TABLE(acpi, xlp_gpio_acpi_match);
--
2.55.0.11.g153666a7d9bb