Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 0/2] crypto: use designated initializers for acpi_device_id
@ 2026-09-03 15:42 Pawel Zalewski (The Capable Hub)
  2026-09-03 15:42 ` [PATCH 1/2] crypto: ccp: use named " Pawel Zalewski (The Capable Hub)
  2026-09-03 15:42 ` [PATCH 2/2] crypto: hisilicon/sec: " Pawel Zalewski (The Capable Hub)
  0 siblings, 2 replies; 4+ messages in thread
From: Pawel Zalewski (The Capable Hub) @ 2026-09-03 15:42 UTC (permalink / raw)
  To: Tom Lendacky, John Allen, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-kernel, Pawel Zalewski (The Capable Hub)

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 (this series)
- actual implementations that make some of the modules use the new driver_data_ptr

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

Tested builds on x86-64 and a64 in Yocto using 7.3-rc1.

[1] https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/

Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
---
Pawel Zalewski (The Capable Hub) (2):
      crypto: ccp: use named initializers for acpi_device_id
      crypto: hisilicon/sec: use named initializers for acpi_device_id

 drivers/crypto/ccp/sp-platform.c       | 4 ++--
 drivers/crypto/hisilicon/sec/sec_drv.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 940de590b839f71d6dc846160534bf202401b8b7
change-id: 20260903-acpi-crypto-c16d403f1022

Best regards,
--  
Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>


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

* [PATCH 1/2] crypto: ccp: use named initializers for acpi_device_id
  2026-09-03 15:42 [PATCH 0/2] crypto: use designated initializers for acpi_device_id Pawel Zalewski (The Capable Hub)
@ 2026-09-03 15:42 ` Pawel Zalewski (The Capable Hub)
  2026-09-08 20:21   ` Tom Lendacky
  2026-09-03 15:42 ` [PATCH 2/2] crypto: hisilicon/sec: " Pawel Zalewski (The Capable Hub)
  1 sibling, 1 reply; 4+ messages in thread
From: Pawel Zalewski (The Capable Hub) @ 2026-09-03 15:42 UTC (permalink / raw)
  To: Tom Lendacky, John Allen, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-kernel, Pawel Zalewski (The Capable Hub)

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.

While we are at it - unify the list terminator to have
a single space between the brackets and no trailing
comma.

Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
---
 drivers/crypto/ccp/sp-platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
index 3f9843fa77827..c7ac840cbe136 100644
--- a/drivers/crypto/ccp/sp-platform.c
+++ b/drivers/crypto/ccp/sp-platform.c
@@ -40,8 +40,8 @@ static const struct sp_dev_vdata dev_vdata[] = {
 };
 
 static const struct acpi_device_id sp_acpi_match[] = {
-	{ "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] },
-	{ },
+	{ .id = "AMDI0C00", .driver_data = (kernel_ulong_t)&dev_vdata[0] },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, sp_acpi_match);
 

-- 
2.43.0


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

* [PATCH 2/2] crypto: hisilicon/sec: use named initializers for acpi_device_id
  2026-09-03 15:42 [PATCH 0/2] crypto: use designated initializers for acpi_device_id Pawel Zalewski (The Capable Hub)
  2026-09-03 15:42 ` [PATCH 1/2] crypto: ccp: use named " Pawel Zalewski (The Capable Hub)
@ 2026-09-03 15:42 ` Pawel Zalewski (The Capable Hub)
  1 sibling, 0 replies; 4+ messages in thread
From: Pawel Zalewski (The Capable Hub) @ 2026-09-03 15:42 UTC (permalink / raw)
  To: Tom Lendacky, John Allen, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-kernel, Pawel Zalewski (The Capable Hub)

Use a designated 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 (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
---
 drivers/crypto/hisilicon/sec/sec_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/sec/sec_drv.c b/drivers/crypto/hisilicon/sec/sec_drv.c
index 2514a5e1f9b4..7d3fb8d67203 100644
--- a/drivers/crypto/hisilicon/sec/sec_drv.c
+++ b/drivers/crypto/hisilicon/sec/sec_drv.c
@@ -1285,7 +1285,7 @@ static const __maybe_unused struct of_device_id sec_match[] = {
 MODULE_DEVICE_TABLE(of, sec_match);
 
 static const __maybe_unused struct acpi_device_id sec_acpi_match[] = {
-	{ "HISI02C1", 0 },
+	{ .id = "HISI02C1" },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, sec_acpi_match);

-- 
2.43.0


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

* Re: [PATCH 1/2] crypto: ccp: use named initializers for acpi_device_id
  2026-09-03 15:42 ` [PATCH 1/2] crypto: ccp: use named " Pawel Zalewski (The Capable Hub)
@ 2026-09-08 20:21   ` Tom Lendacky
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Lendacky @ 2026-09-08 20:21 UTC (permalink / raw)
  To: Pawel Zalewski (The Capable Hub), John Allen, Herbert Xu,
	David S. Miller
  Cc: linux-crypto, linux-kernel

On 9/3/26 10:42, Pawel Zalewski (The Capable Hub) 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.
> 
> While we are at it - unify the list terminator to have
> a single space between the brackets and no trailing
> comma.
> 
> Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>  drivers/crypto/ccp/sp-platform.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
> index 3f9843fa77827..c7ac840cbe136 100644
> --- a/drivers/crypto/ccp/sp-platform.c
> +++ b/drivers/crypto/ccp/sp-platform.c
> @@ -40,8 +40,8 @@ static const struct sp_dev_vdata dev_vdata[] = {
>  };
>  
>  static const struct acpi_device_id sp_acpi_match[] = {
> -	{ "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] },
> -	{ },
> +	{ .id = "AMDI0C00", .driver_data = (kernel_ulong_t)&dev_vdata[0] },
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, sp_acpi_match);
>  
> 


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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 15:42 [PATCH 0/2] crypto: use designated initializers for acpi_device_id Pawel Zalewski (The Capable Hub)
2026-09-03 15:42 ` [PATCH 1/2] crypto: ccp: use named " Pawel Zalewski (The Capable Hub)
2026-09-08 20:21   ` Tom Lendacky
2026-09-03 15:42 ` [PATCH 2/2] crypto: hisilicon/sec: " Pawel Zalewski (The Capable Hub)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox