mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] firmware: coreboot: use named initializers for acpi_device_id
@ 2026-09-07 14:00 Pawel Zalewski
  2026-09-08  3:06 ` Tzung-Bi Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Pawel Zalewski @ 2026-09-07 14:00 UTC (permalink / raw)
  To: Tzung-Bi Shih, Brian Norris, Julius Werner
  Cc: chrome-platform, linux-kernel, Pawel Zalewski

Use a named 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.

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 (as 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
driver_data_ptr union member

That way the task can be fragmented into manageable and independent
chunks of work and makes this effort easier to review.

Tested builds on a64 in Yocto using 7.3-rc1.

[1] https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/
---
Changes in v2:
- Rebased on linux-next
- Link to v1: https://patch.msgid.link/20260904-acpi-firmware-v1-1-7e4d7a09198e@thegoodpenguin.co.uk

To: Tzung-Bi Shih <tzungbi@kernel.org>
To: Brian Norris <briannorris@chromium.org>
To: Julius Werner <jwerner@chromium.org>
Cc: chrome-platform@lists.linux.dev
Cc: linux-kernel@vger.kernel.org
---
 drivers/firmware/coreboot/coreboot_table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/coreboot/coreboot_table.c b/drivers/firmware/coreboot/coreboot_table.c
index 25ee8cf53429..2c8c928fbb33 100644
--- a/drivers/firmware/coreboot/coreboot_table.c
+++ b/drivers/firmware/coreboot/coreboot_table.c
@@ -250,8 +250,8 @@ static void coreboot_table_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id cros_coreboot_acpi_match[] = {
-	{ "GOOGCB00", 0 },
-	{ "BOOT0000", 0 },
+	{ .id = "GOOGCB00" },
+	{ .id = "BOOT0000" },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, cros_coreboot_acpi_match);

---
base-commit: af5f12805e5cefa4fe68d6127c7e1fb78cd5535c
change-id: 20260904-acpi-firmware-5c9fd18aaea0

Best regards,
--  
Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] firmware: coreboot: use named initializers for acpi_device_id
  2026-09-07 14:00 [PATCH v2] firmware: coreboot: use named initializers for acpi_device_id Pawel Zalewski
@ 2026-09-08  3:06 ` Tzung-Bi Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Tzung-Bi Shih @ 2026-09-08  3:06 UTC (permalink / raw)
  To: Pawel Zalewski; +Cc: Brian Norris, Julius Werner, chrome-platform, linux-kernel

On Mon, Sep 07, 2026 at 03:00:45PM +0100, Pawel Zalewski wrote:
> Use a named 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.

Applied to

    https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-firmware-next

[1/1] firmware: coreboot: use named initializers for acpi_device_id
      commit: 0e30b98a545991e440a947fb24f9df4ded9798f0

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-08  3:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-07 14:00 [PATCH v2] firmware: coreboot: use named initializers for acpi_device_id Pawel Zalewski
2026-09-08  3:06 ` Tzung-Bi Shih

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®