From: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
To: linux-pwm@vger.kernel.org
Cc: Binbin Zhou <zhoubinbin@loongson.cn>, linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/5] pwm: Use named initializers for arrays of acpi_device_id
Date: Sun, 5 Jul 2026 17:14:14 +0200 [thread overview]
Message-ID: <1a03da9625e1e6bf2befa13c64525e2dfa2243e7.1783263835.git.ukleinek@kernel.org> (raw)
In-Reply-To: <cover.1783263835.git.ukleinek@kernel.org>
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@baylibre.com>
---
drivers/pwm/pwm-loongson.c | 2 +-
drivers/pwm/pwm-lpss-platform.c | 8 ++++----
drivers/pwm/pwm-pca9685.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pwm/pwm-loongson.c b/drivers/pwm/pwm-loongson.c
index 31a57edecfd0..f2fb35b7af2b 100644
--- a/drivers/pwm/pwm-loongson.c
+++ b/drivers/pwm/pwm-loongson.c
@@ -269,7 +269,7 @@ static const struct of_device_id pwm_loongson_of_ids[] = {
MODULE_DEVICE_TABLE(of, pwm_loongson_of_ids);
static const struct acpi_device_id pwm_loongson_acpi_ids[] = {
- { "LOON0006" },
+ { .id = "LOON0006" },
{ }
};
MODULE_DEVICE_TABLE(acpi, pwm_loongson_acpi_ids);
diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c
index 653ec9d0c8bf..0d4f8bf04e9f 100644
--- a/drivers/pwm/pwm-lpss-platform.c
+++ b/drivers/pwm/pwm-lpss-platform.c
@@ -59,10 +59,10 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)
}
static const struct acpi_device_id pwm_lpss_acpi_match[] = {
- { "80860F09", (unsigned long)&pwm_lpss_byt_info },
- { "80862288", (unsigned long)&pwm_lpss_bsw_info },
- { "80862289", (unsigned long)&pwm_lpss_bsw_info },
- { "80865AC8", (unsigned long)&pwm_lpss_bxt_info },
+ { .id = "80860F09", .driver_data = (unsigned long)&pwm_lpss_byt_info },
+ { .id = "80862288", .driver_data = (unsigned long)&pwm_lpss_bsw_info },
+ { .id = "80862289", .driver_data = (unsigned long)&pwm_lpss_bsw_info },
+ { .id = "80865AC8", .driver_data = (unsigned long)&pwm_lpss_bxt_info },
{ },
};
MODULE_DEVICE_TABLE(acpi, pwm_lpss_acpi_match);
diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c
index 617a74de68c7..0982ba4f566c 100644
--- a/drivers/pwm/pwm-pca9685.c
+++ b/drivers/pwm/pwm-pca9685.c
@@ -544,7 +544,7 @@ static const struct i2c_device_id pca9685_id[] = {
MODULE_DEVICE_TABLE(i2c, pca9685_id);
static const struct acpi_device_id pca9685_acpi_ids[] = {
- { "INT3492" },
+ { .id = "INT3492" },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(acpi, pca9685_acpi_ids);
--
2.55.0.11.g153666a7d9bb
next prev parent reply other threads:[~2026-07-05 15:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 15:14 [PATCH v1 0/5] pwm: Unify arrays of various *_device_id Uwe Kleine-König (The Capable Hub)
2026-07-05 15:14 ` [PATCH v1 1/5] pwm: pca9685: Drop unused assignment of acpi_device_id driver data Uwe Kleine-König (The Capable Hub)
2026-07-05 15:14 ` Uwe Kleine-König (The Capable Hub) [this message]
2026-07-05 15:14 ` [PATCH v1 3/5] pwm: Unify coding style of acpi_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-05 15:14 ` [PATCH v1 4/5] pwm: Unify coding style of of_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-06 0:33 ` Chen Wang
2026-07-06 7:19 ` Uwe Kleine-König (The Capable Hub)
2026-07-06 8:28 ` Philippe Mathieu-Daudé
2026-07-06 10:39 ` Uwe Kleine-König (The Capable Hub)
2026-07-06 10:41 ` Krzysztof Kozlowski
2026-07-06 8:00 ` Geert Uytterhoeven
2026-07-05 15:14 ` [PATCH v1 5/5] pwm: lpss-pci: Unify coding style of pci_device_id array Uwe Kleine-König (The Capable Hub)
2026-07-10 8:03 ` [PATCH v1 0/5] pwm: Unify arrays of various *_device_id Uwe Kleine-König (The Capable Hub)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a03da9625e1e6bf2befa13c64525e2dfa2243e7.1783263835.git.ukleinek@kernel.org \
--to=u.kleine-koenig@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=zhoubinbin@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®