Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH 0/2] ata: use named initializers for acpi_device_id
@ 2026-08-03 15:03 Pawel Zalewski via B4 Relay
  2026-08-03 15:03 ` [PATCH 1/2] " Pawel Zalewski via B4 Relay
  2026-08-03 15:03 ` [PATCH 2/2] ata: ahci_seattle: drop unused acpi_device_id::driver_data Pawel Zalewski via B4 Relay
  0 siblings, 2 replies; 7+ messages in thread
From: Pawel Zalewski via B4 Relay @ 2026-08-03 15:03 UTC (permalink / raw)
  To: Hans de Goede, Damien Le Moal, Niklas Cassel
  Cc: linux-ide, 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 makes 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. 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 in Yocto using 7.2-rc6

Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
---
Pawel Zalewski (The Capable Hub) (2):
      ata: use named initializers for acpi_device_id
      ata: ahci_seattle: drop unused acpi_device_id::driver_data

 drivers/ata/ahci_platform.c | 4 ++--
 drivers/ata/ahci_qoriq.c    | 2 +-
 drivers/ata/ahci_seattle.c  | 4 ++--
 drivers/ata/ahci_xgene.c    | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)
---
base-commit: 9ecfb2f7287a967b418ba69f10d45ead0d360593
change-id: 20260803-ata-acpi-18f405eb03a2

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



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

* [PATCH 1/2] ata: use named initializers for acpi_device_id
  2026-08-03 15:03 [PATCH 0/2] ata: use named initializers for acpi_device_id Pawel Zalewski via B4 Relay
@ 2026-08-03 15:03 ` Pawel Zalewski via B4 Relay
  2026-08-03 15:14   ` sashiko-bot
  2026-08-03 15:03 ` [PATCH 2/2] ata: ahci_seattle: drop unused acpi_device_id::driver_data Pawel Zalewski via B4 Relay
  1 sibling, 1 reply; 7+ messages in thread
From: Pawel Zalewski via B4 Relay @ 2026-08-03 15:03 UTC (permalink / raw)
  To: Hans de Goede, Damien Le Moal, Niklas Cassel
  Cc: linux-ide, linux-kernel, Pawel Zalewski (The Capable Hub)

From: "Pawel Zalewski (The Capable Hub)" <pzalewski@thegoodpenguin.co.uk>

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/ata/ahci_platform.c | 4 ++--
 drivers/ata/ahci_qoriq.c    | 2 +-
 drivers/ata/ahci_xgene.c    | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index c18054333f7c..d97f0ad3b4cd 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -88,9 +88,9 @@ static const struct of_device_id ahci_of_match[] = {
 MODULE_DEVICE_TABLE(of, ahci_of_match);
 
 static const struct acpi_device_id ahci_acpi_match[] = {
-	{ "APMC0D33", (unsigned long)&ahci_port_info_nolpm },
+	{ .id = "APMC0D33", .driver_data = (unsigned long)&ahci_port_info_nolpm },
 	{ ACPI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) },
-	{},
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, ahci_acpi_match);
 
diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index 0dec1a17e5b1..96492159fa7c 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -80,7 +80,7 @@ static const struct of_device_id ahci_qoriq_of_match[] = {
 MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
 
 static const struct acpi_device_id ahci_qoriq_acpi_match[] = {
-	{"NXP0004", .driver_data = (kernel_ulong_t)AHCI_LX2160A},
+	{ .id = "NXP0004", .driver_data = (kernel_ulong_t)AHCI_LX2160A },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, ahci_qoriq_acpi_match);
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 98c99b5a8242..2ebfe86e429b 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -710,9 +710,9 @@ static const struct scsi_host_template ahci_platform_sht = {
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id xgene_ahci_acpi_match[] = {
-	{ "APMC0D0D", XGENE_AHCI_V1},
-	{ "APMC0D32", XGENE_AHCI_V2},
-	{},
+	{ .id = "APMC0D0D", .driver_data = XGENE_AHCI_V1 },
+	{ .id = "APMC0D32", .driver_data = XGENE_AHCI_V2 },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, xgene_ahci_acpi_match);
 #endif

-- 
2.54.0



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

* [PATCH 2/2] ata: ahci_seattle: drop unused acpi_device_id::driver_data
  2026-08-03 15:03 [PATCH 0/2] ata: use named initializers for acpi_device_id Pawel Zalewski via B4 Relay
  2026-08-03 15:03 ` [PATCH 1/2] " Pawel Zalewski via B4 Relay
@ 2026-08-03 15:03 ` Pawel Zalewski via B4 Relay
  1 sibling, 0 replies; 7+ messages in thread
From: Pawel Zalewski via B4 Relay @ 2026-08-03 15:03 UTC (permalink / raw)
  To: Hans de Goede, Damien Le Moal, Niklas Cassel
  Cc: linux-ide, linux-kernel, Pawel Zalewski (The Capable Hub)

From: "Pawel Zalewski (The Capable Hub)" <pzalewski@thegoodpenguin.co.uk>

This module sets the acpi_device_id::driver_data to 0 but
the id is not actually used within the module, we can
just drop it from the list.

While we are at it - used a named initializer for the
acpi_device_id::id field to increase readability and
modify the list terminator to have a single space in
between the brackets.

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

diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c
index 3f16c1678402..9758fa0260ac 100644
--- a/drivers/ata/ahci_seattle.c
+++ b/drivers/ata/ahci_seattle.c
@@ -178,8 +178,8 @@ static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
 			 ahci_platform_resume);
 
 static const struct acpi_device_id ahci_acpi_match[] = {
-	{ "AMDI0600", 0 },
-	{}
+	{ .id = "AMDI0600" },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, ahci_acpi_match);
 

-- 
2.54.0



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

* Re: [PATCH 1/2] ata: use named initializers for acpi_device_id
  2026-08-03 15:03 ` [PATCH 1/2] " Pawel Zalewski via B4 Relay
@ 2026-08-03 15:14   ` sashiko-bot
  2026-08-03 19:58     ` Niklas Cassel
  0 siblings, 1 reply; 7+ messages in thread
From: sashiko-bot @ 2026-08-03 15:14 UTC (permalink / raw)
  To: Pawel Zalewski (The Capable Hub); +Cc: cassel, linux-ide, dlemoal

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incomplete refactoring: ahci_seattle.c was missed when unifying acpi_device_id initialization.
--

--- Patch [1]: [PATCH 1/2] ata: use named initializers for acpi_device_id ---
commit f6b3d365ff5924969c9b77b57308411fcb82b7e1
Author: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>

ata: use named initializers for acpi_device_id

This commit updates acpi_device_id initializers in the ATA subsystem
to use named fields. It also unifies the list terminators across these
files to have a single space between the brackets.

> ata: use named initializers for acpi_device_id
> 
> 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.

[Severity: Low]
Was ahci_seattle.c missed during this refactoring? 

It appears drivers/ata/ahci_seattle.c still contains an old style
initializer and a list terminator without a space:

drivers/ata/ahci_seattle.c:ahci_acpi_match() {
static const struct acpi_device_id ahci_acpi_match[] = {
	{ "AMDI0600", 0 },
	{}
};

> 
> Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
> 
> diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
> index c18054333f7c9..d97f0ad3b4cd7 100644
> --- a/drivers/ata/ahci_platform.c
> +++ b/drivers/ata/ahci_platform.c

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260803-ata-acpi-v1-0-f606afaacad1@thegoodpenguin.co.uk?part=1

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

* Re: [PATCH 1/2] ata: use named initializers for acpi_device_id
  2026-08-03 15:14   ` sashiko-bot
@ 2026-08-03 19:58     ` Niklas Cassel
  2026-08-04  6:09       ` Pawel Zalewski
  0 siblings, 1 reply; 7+ messages in thread
From: Niklas Cassel @ 2026-08-03 19:58 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: Pawel Zalewski (The Capable Hub), linux-ide, dlemoal

On Mon, Aug 03, 2026 at 03:14:16PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Incomplete refactoring: ahci_seattle.c was missed when unifying acpi_device_id initialization.
> --
> 
> --- Patch [1]: [PATCH 1/2] ata: use named initializers for acpi_device_id ---
> commit f6b3d365ff5924969c9b77b57308411fcb82b7e1
> Author: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>
> 
> ata: use named initializers for acpi_device_id
> 
> This commit updates acpi_device_id initializers in the ATA subsystem
> to use named fields. It also unifies the list terminators across these
> files to have a single space between the brackets.
> 
> > ata: use named initializers for acpi_device_id
> > 
> > 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.
> 
> [Severity: Low]
> Was ahci_seattle.c missed during this refactoring? 
> 
> It appears drivers/ata/ahci_seattle.c still contains an old style
> initializer and a list terminator without a space:
> 
> drivers/ata/ahci_seattle.c:ahci_acpi_match() {
> static const struct acpi_device_id ahci_acpi_match[] = {
> 	{ "AMDI0600", 0 },
> 	{}


The series looks good to me.

I do kind of agree with Sashiko that ahci_seattle.c could have been fixed
in patch 1/2 (rather than fixing ahci_seattle.c in patch 2/2).

drivers/ata/ahci_seattle.c:ahci_acpi_match() {
static const struct acpi_device_id ahci_acpi_match[] = {
	{ "AMDI0600", 0 },
	{}

Having a .driver_data of 0 is redundant, regardless if the driver uses it
or not, since the struct is defined as static, and is thus guaranteed to
be zero-initialized.


Kind regards,
Niklas

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

* Re: [PATCH 1/2] ata: use named initializers for acpi_device_id
  2026-08-03 19:58     ` Niklas Cassel
@ 2026-08-04  6:09       ` Pawel Zalewski
  2026-08-04  7:01         ` Niklas Cassel
  0 siblings, 1 reply; 7+ messages in thread
From: Pawel Zalewski @ 2026-08-04  6:09 UTC (permalink / raw)
  To: Niklas Cassel; +Cc: sashiko-reviews, linux-ide, dlemoal

>I do kind of agree with Sashiko that ahci_seattle.c could have been fixed
> in patch 1/2 (rather than fixing ahci_seattle.c in patch 2/2).

Happy to refactor in V2 so that patch 2 would only deal with removing
driver_data = 0
in the ahci_seattle module.

Kind regards,
Pawel

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

* Re: [PATCH 1/2] ata: use named initializers for acpi_device_id
  2026-08-04  6:09       ` Pawel Zalewski
@ 2026-08-04  7:01         ` Niklas Cassel
  0 siblings, 0 replies; 7+ messages in thread
From: Niklas Cassel @ 2026-08-04  7:01 UTC (permalink / raw)
  To: Pawel Zalewski; +Cc: sashiko-reviews, linux-ide, dlemoal

On 4 August 2026 08:09:52 CEST, Pawel Zalewski <pzalewski@thegoodpenguin.co.uk> wrote:
>>I do kind of agree with Sashiko that ahci_seattle.c could have been fixed
>> in patch 1/2 (rather than fixing ahci_seattle.c in patch 2/2).
>
>Happy to refactor in V2 so that patch 2 would only deal with removing
>driver_data = 0
>in the ahci_seattle module.
>

I am usually the one who prefer things to be split into multiple patches.

But in this case, I think you can do everything in the same patch.

Still seems like the same logical change, clarifying/cleaning up the initializers.


Kind regards,
Niklas

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

end of thread, other threads:[~2026-08-04  7:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 15:03 [PATCH 0/2] ata: use named initializers for acpi_device_id Pawel Zalewski via B4 Relay
2026-08-03 15:03 ` [PATCH 1/2] " Pawel Zalewski via B4 Relay
2026-08-03 15:14   ` sashiko-bot
2026-08-03 19:58     ` Niklas Cassel
2026-08-04  6:09       ` Pawel Zalewski
2026-08-04  7:01         ` Niklas Cassel
2026-08-03 15:03 ` [PATCH 2/2] ata: ahci_seattle: drop unused acpi_device_id::driver_data Pawel Zalewski via B4 Relay

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