From: Benson Leung <bleung@chromium.org>
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: Lee Jones <lee@kernel.org>, Linus Walleij <linusw@kernel.org>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-arm-kernel@lists.infradead.org, mfd@lists.linux.dev,
linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v4 15/20] mfd: Use named initializers for platform_device_id array
Date: Tue, 10 Nov 2026 23:07:55 +0000 [thread overview]
Message-ID: <avOjy_fN7YtF3qfm@google.com> (raw)
In-Reply-To: <19b9b030217016ca7f4b0d9d9fc9ab915a8963f2.1794347059.git.u.kleine-koenig@baylibre.com>
[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]
On Tue, Nov 10, 2026 at 10:54:40PM +0100, Uwe Kleine-König (The Capable Hub) wrote:
> 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
> platform_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.
>
> Also drop a tailing comma after a list terminator to match the common
> style for these device-id arrays.
>
> Reviewed-by: Linus Walleij <linusw@kernel.org>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
> ---
> drivers/mfd/ab8500-core.c | 8 ++++----
> drivers/mfd/cros_ec_dev.c | 2 +-
> drivers/mfd/mt6397-core.c | 4 ++--
> 3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
> index d5602b2f4a0e..8638fc8472f7 100644
> --- a/drivers/mfd/ab8500-core.c
> +++ b/drivers/mfd/ab8500-core.c
> @@ -1252,10 +1252,10 @@ static int ab8500_probe(struct platform_device *pdev)
> }
>
> static const struct platform_device_id ab8500_id[] = {
> - { "ab8500-core", AB8500_VERSION_AB8500 },
> - { "ab8505-core", AB8500_VERSION_AB8505 },
> - { "ab9540-i2c", AB8500_VERSION_AB9540 },
> - { "ab8540-i2c", AB8500_VERSION_AB8540 },
> + { .name = "ab8500-core", .driver_data = AB8500_VERSION_AB8500 },
> + { .name = "ab8505-core", .driver_data = AB8500_VERSION_AB8505 },
> + { .name = "ab9540-i2c", .driver_data = AB8500_VERSION_AB9540 },
> + { .name = "ab8540-i2c", .driver_data = AB8500_VERSION_AB8540 },
> { }
> };
>
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 96aac158fd8b..3c7e7f1efd0f 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -379,7 +379,7 @@ static void ec_device_remove(struct platform_device *pdev)
> }
>
> static const struct platform_device_id cros_ec_id[] = {
> - { DRV_NAME },
> + { .name = DRV_NAME },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(platform, cros_ec_id);
> diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
> index e74936ac206f..385121867da5 100644
> --- a/drivers/mfd/mt6397-core.c
> +++ b/drivers/mfd/mt6397-core.c
> @@ -435,8 +435,8 @@ static const struct of_device_id mt6397_of_match[] = {
> MODULE_DEVICE_TABLE(of, mt6397_of_match);
>
> static const struct platform_device_id mt6397_id[] = {
> - { "mt6397" },
> - { },
> + { .name = "mt6397" },
> + { }
> };
> MODULE_DEVICE_TABLE(platform, mt6397_id);
>
> --
> 2.56.0.rc1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-11-10 23:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 21:54 [PATCH v4 00/20] mfd: Use named initializers for arrays of *_device_data Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 01/20] mfd: bcm2835-pm: Remove member of struct bcm2835_pm that is only used locally Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 02/20] mfd: bcm2835-pm: Drop unused header Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 03/20] mfd: kempld: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 04/20] mfd: lp87565: Explicitly set driver data for the generic dt compatible Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 05/20] mfd: mt6360: Drop irrelevant __maybe_unused Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 06/20] mfd: rt4831: " Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 07/20] mfd: loongson-se: Drop unused assignment of acpi_device_id driver data Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 08/20] mfd: Drop unused assignment of i2c_device_id " Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 09/20] mfd: Drop unused assignment of platform_device_id " Uwe Kleine-König (The Capable Hub)
2026-11-10 23:05 ` Benson Leung
2026-11-10 21:54 ` [PATCH v4 10/20] mfd: Use named initializers for acpi_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 11/20] mfd: intel-m10-bmc-pmci: Use named initializers for dfl_device_id array Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 12/20] mfd: Use named initializers for arrays of i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 13/20] mfd: twl6030: Use named initializers for of_device_id Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 14/20] mfd: Use PCI_DEVICE* macros to initialize pci_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 15/20] mfd: Use named initializers for platform_device_id array Uwe Kleine-König (The Capable Hub)
2026-11-10 23:07 ` Benson Leung [this message]
2026-11-10 21:54 ` [PATCH v4 16/20] mfd: Unify style of acpi_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 17/20] mfd: Unify style of dmi_system_id arrays Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 18/20] mfd: Unify style of i2c_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-11-10 21:54 ` [PATCH v4 19/20] mfd: Unify style of of_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-11-11 2:15 ` Chen-Yu Tsai
2026-11-10 21:54 ` [PATCH v4 20/20] mfd: Unify style of pci_device_id arrays 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=avOjy_fN7YtF3qfm@google.com \
--to=bleung@chromium.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chrome-platform@lists.linux.dev \
--cc=groeck@chromium.org \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mfd@lists.linux.dev \
--cc=u.kleine-koenig@baylibre.com \
/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®