Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: Use named initializers for acpi_device_id
@ 2026-11-06 15:55 Pawel Zalewski
  2026-11-06 17:36 ` Adrian Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Pawel Zalewski @ 2026-11-06 15:55 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Hu Ziji
  Cc: linux-mmc, linux-kernel, linux-arm-kernel, Pawel Zalewski

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.

Unify the list terminator to have a single space between the brackets and
no trailing comma.

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 (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 new
  driver_data_ptr member

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

[1] https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/
---
 drivers/mmc/host/sdhci-acpi.c       | 30 +++++++++++++++---------------
 drivers/mmc/host/sdhci-iproc.c      |  2 +-
 drivers/mmc/host/sdhci-of-dwcmshc.c |  2 +-
 drivers/mmc/host/sdhci-xenon.c      |  8 ++++----
 drivers/mmc/host/sdhci_f_sdh30.c    |  4 ++--
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 84c7054607fc..e97c33614fd1 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -704,21 +704,21 @@ static const struct sdhci_acpi_uid_slot sdhci_acpi_uids[] = {
 };
 
 static const struct acpi_device_id sdhci_acpi_ids[] = {
-	{ "80865ACA" },
-	{ "80865ACC" },
-	{ "80865AD0" },
-	{ "80860F14" },
-	{ "80860F16" },
-	{ "INT33BB"  },
-	{ "INT33C6"  },
-	{ "INT3436"  },
-	{ "INT344D"  },
-	{ "PNP0D40"  },
-	{ "QCOM8051" },
-	{ "QCOM8052" },
-	{ "AMDI0040" },
-	{ "AMDI0041" },
-	{ },
+	{ .id = "80865ACA" },
+	{ .id = "80865ACC" },
+	{ .id = "80865AD0" },
+	{ .id = "80860F14" },
+	{ .id = "80860F16" },
+	{ .id = "INT33BB" },
+	{ .id = "INT33C6" },
+	{ .id = "INT3436" },
+	{ .id = "INT344D" },
+	{ .id = "PNP0D40" },
+	{ .id = "QCOM8051" },
+	{ .id = "QCOM8052" },
+	{ .id = "AMDI0040" },
+	{ .id = "AMDI0041" },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
 
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 35ef5c5f5146..db5bed2397f6 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -350,7 +350,7 @@ static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
 	{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
 	{ .id = "BCM2847",  .driver_data = (kernel_ulong_t)&bcm_arasan_data },
 	{ .id = "BRCME88C", .driver_data = (kernel_ulong_t)&bcm2711_data },
-	{ /* sentinel */ }
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
 #endif
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index 09702022e708..113a9399d7dc 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -2400,7 +2400,7 @@ static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
 		.id = "MLNXBF30",
 		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
 	},
-	{}
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, sdhci_dwcmshc_acpi_ids);
 #endif
diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
index 046e8100dd08..2e4926e722f3 100644
--- a/drivers/mmc/host/sdhci-xenon.c
+++ b/drivers/mmc/host/sdhci-xenon.c
@@ -700,10 +700,10 @@ MODULE_DEVICE_TABLE(of, sdhci_xenon_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_xenon_acpi_ids[] = {
-	{ .id = "MRVL0002", XENON_AP806},
-	{ .id = "MRVL0003", XENON_AP807},
-	{ .id = "MRVL0004", XENON_CP110},
-	{}
+	{ .id = "MRVL0002", .driver_data = XENON_AP806 },
+	{ .id = "MRVL0003", .driver_data = XENON_AP807 },
+	{ .id = "MRVL0004", .driver_data = XENON_CP110 },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, sdhci_xenon_acpi_ids);
 #endif
diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
index e9b934e159ad..f3d0a50d1a6f 100644
--- a/drivers/mmc/host/sdhci_f_sdh30.c
+++ b/drivers/mmc/host/sdhci_f_sdh30.c
@@ -227,8 +227,8 @@ MODULE_DEVICE_TABLE(of, f_sdh30_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id f_sdh30_acpi_ids[] = {
-	{ "SCX0002" },
-	{ /* sentinel */ }
+	{ .id = "SCX0002" },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, f_sdh30_acpi_ids);
 #endif

---
base-commit: f66469d9905b39d2c260a15d7d6db450f4db67c1
change-id: 20261102-acpi-mmc-7bbb96467dd8

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


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

* Re: [PATCH] mmc: sdhci: Use named initializers for acpi_device_id
  2026-11-06 15:55 [PATCH] mmc: sdhci: Use named initializers for acpi_device_id Pawel Zalewski
@ 2026-11-06 17:36 ` Adrian Hunter
  2026-11-10  9:25   ` Pawel Zalewski
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2026-11-06 17:36 UTC (permalink / raw)
  To: Pawel Zalewski, Ulf Hansson, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Hu Ziji
  Cc: linux-mmc, linux-kernel, linux-arm-kernel

On 06/11/2026 17:55, Pawel Zalewski wrote:
> 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.

Why is there a different explanation above the "---" than below "---" ?

> 
> Unify the list terminator to have a single space between the brackets and
> no trailing comma.

Why?

> 
> 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 (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 new
>   driver_data_ptr member
> 
> That way the task can be fragmented into manageable and independent chunks
> of work and makes this effort easier to review.
> 
> [1] https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/
> ---
>  drivers/mmc/host/sdhci-acpi.c       | 30 +++++++++++++++---------------
>  drivers/mmc/host/sdhci-iproc.c      |  2 +-
>  drivers/mmc/host/sdhci-of-dwcmshc.c |  2 +-
>  drivers/mmc/host/sdhci-xenon.c      |  8 ++++----
>  drivers/mmc/host/sdhci_f_sdh30.c    |  4 ++--
>  5 files changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index 84c7054607fc..e97c33614fd1 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -704,21 +704,21 @@ static const struct sdhci_acpi_uid_slot sdhci_acpi_uids[] = {
>  };
>  
>  static const struct acpi_device_id sdhci_acpi_ids[] = {
> -	{ "80865ACA" },
> -	{ "80865ACC" },
> -	{ "80865AD0" },
> -	{ "80860F14" },
> -	{ "80860F16" },
> -	{ "INT33BB"  },
> -	{ "INT33C6"  },
> -	{ "INT3436"  },
> -	{ "INT344D"  },
> -	{ "PNP0D40"  },
> -	{ "QCOM8051" },
> -	{ "QCOM8052" },
> -	{ "AMDI0040" },
> -	{ "AMDI0041" },
> -	{ },
> +	{ .id = "80865ACA" },
> +	{ .id = "80865ACC" },
> +	{ .id = "80865AD0" },
> +	{ .id = "80860F14" },
> +	{ .id = "80860F16" },
> +	{ .id = "INT33BB" },
> +	{ .id = "INT33C6" },
> +	{ .id = "INT3436" },
> +	{ .id = "INT344D" },
> +	{ .id = "PNP0D40" },
> +	{ .id = "QCOM8051" },
> +	{ .id = "QCOM8052" },
> +	{ .id = "AMDI0040" },
> +	{ .id = "AMDI0041" },
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
>  
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 35ef5c5f5146..db5bed2397f6 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -350,7 +350,7 @@ static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
>  	{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
>  	{ .id = "BCM2847",  .driver_data = (kernel_ulong_t)&bcm_arasan_data },
>  	{ .id = "BRCME88C", .driver_data = (kernel_ulong_t)&bcm2711_data },
> -	{ /* sentinel */ }
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
>  #endif
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 09702022e708..113a9399d7dc 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -2400,7 +2400,7 @@ static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
>  		.id = "MLNXBF30",
>  		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
>  	},
> -	{}
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, sdhci_dwcmshc_acpi_ids);
>  #endif
> diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
> index 046e8100dd08..2e4926e722f3 100644
> --- a/drivers/mmc/host/sdhci-xenon.c
> +++ b/drivers/mmc/host/sdhci-xenon.c
> @@ -700,10 +700,10 @@ MODULE_DEVICE_TABLE(of, sdhci_xenon_dt_ids);
>  
>  #ifdef CONFIG_ACPI
>  static const struct acpi_device_id sdhci_xenon_acpi_ids[] = {
> -	{ .id = "MRVL0002", XENON_AP806},
> -	{ .id = "MRVL0003", XENON_AP807},
> -	{ .id = "MRVL0004", XENON_CP110},
> -	{}
> +	{ .id = "MRVL0002", .driver_data = XENON_AP806 },
> +	{ .id = "MRVL0003", .driver_data = XENON_AP807 },
> +	{ .id = "MRVL0004", .driver_data = XENON_CP110 },
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, sdhci_xenon_acpi_ids);
>  #endif
> diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
> index e9b934e159ad..f3d0a50d1a6f 100644
> --- a/drivers/mmc/host/sdhci_f_sdh30.c
> +++ b/drivers/mmc/host/sdhci_f_sdh30.c
> @@ -227,8 +227,8 @@ MODULE_DEVICE_TABLE(of, f_sdh30_dt_ids);
>  
>  #ifdef CONFIG_ACPI
>  static const struct acpi_device_id f_sdh30_acpi_ids[] = {
> -	{ "SCX0002" },
> -	{ /* sentinel */ }
> +	{ .id = "SCX0002" },
> +	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, f_sdh30_acpi_ids);
>  #endif
> 
> ---
> base-commit: f66469d9905b39d2c260a15d7d6db450f4db67c1
> change-id: 20261102-acpi-mmc-7bbb96467dd8
> 
> Best regards,
> --  
> Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
> 


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

* Re: [PATCH] mmc: sdhci: Use named initializers for acpi_device_id
  2026-11-06 17:36 ` Adrian Hunter
@ 2026-11-10  9:25   ` Pawel Zalewski
  2026-12-03  8:37     ` Adrian Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Pawel Zalewski @ 2026-11-10  9:25 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Ulf Hansson, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Hu Ziji, linux-mmc,
	linux-kernel, linux-arm-kernel

> Why is there a different explanation above the "---" than below "---" ?
 b4 will put the cover letter in the dropped section of a single patch
series, for more information please see [1]. There is no requirement
for them to be equal. The answer to your question is in the cover
letter itself: first series is a refactor pass to allow for the future
intended change in the acpi_device_id struct to go ahead without
triggering build errors. Describing future events in a git message
makes no sense to me.

> > Unify the list terminator to have a single space between the brackets and
> > no trailing comma.
>
> Why?
This seems to be explained in the paragraph above in the commit
message? I can repeat myself if it's not obvious.

[1] https://b4.docs.kernel.org/en/latest/contributor/prep.html#what-if-the-series-only-has-a-single-patch

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

* Re: [PATCH] mmc: sdhci: Use named initializers for acpi_device_id
  2026-11-10  9:25   ` Pawel Zalewski
@ 2026-12-03  8:37     ` Adrian Hunter
  0 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2026-12-03  8:37 UTC (permalink / raw)
  To: Pawel Zalewski
  Cc: Ulf Hansson, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Hu Ziji, linux-mmc,
	linux-kernel, linux-arm-kernel

On 10/11/2026 11:25, Pawel Zalewski wrote:
>> Why is there a different explanation above the "---" than below "---" ?
>  b4 will put the cover letter in the dropped section of a single patch
> series, for more information please see [1]. There is no requirement
> for them to be equal. The answer to your question is in the cover
> letter itself: first series is a refactor pass to allow for the future
> intended change in the acpi_device_id struct to go ahead without
> triggering build errors. Describing future events in a git message
> makes no sense to me.

Patches routinely prepare for later changes and say why.  The commit
message must be able to stand alone.  Yours goes out of its way to avoid
mentioning the actual motivation for the patch.

> 
>>> Unify the list terminator to have a single space between the brackets and
>>> no trailing comma.
>>
>> Why?
> This seems to be explained in the paragraph above in the commit
> message? I can repeat myself if it's not obvious.

Removing an inappropriate comma is ok, but for the rest, is it a
documented style convention, or gratuitous code churn?

> 
> [1] https://b4.docs.kernel.org/en/latest/contributor/prep.html#what-if-the-series-only-has-a-single-patch


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

end of thread, other threads:[~2026-12-03  8:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 15:55 [PATCH] mmc: sdhci: Use named initializers for acpi_device_id Pawel Zalewski
2026-11-06 17:36 ` Adrian Hunter
2026-11-10  9:25   ` Pawel Zalewski
2026-12-03  8:37     ` Adrian Hunter

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