Re: [PATCH] mmc: via-sdmmc: Simplify initialisation of pci_device_id array

From: Ulf Hansson

Date: Mon May 11 2026 - 11:52:49 EST


On Thu, 7 May 2026 at 18:10, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@xxxxxxxxxxxx> wrote:
>
> Instead of assigning the pci_device_id members using a list (which is
> hard to read as you need to look at the order of the members in that
> struct in parallel) use the PCI_VDEVICE() convenience macro to compact
> the initialisation while improving readability.
>
> Also drop trailing zeros that the compiler will care about then.
>
> The change doesn't introduce binary changes to the compiled driver,
> verified on both ARCH=x86 and ARCH=arm64.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>

Applied for next, thanks!

Kind regards
Uffe


> ---
> Hello,
>
> this is a preparing change for making struct pci_device_id::driver_data
> an anonymous union (similar to
> https://lore.kernel.org/all/cover.1776579304.git.u.kleine-koenig@xxxxxxxxxxxx/).
> This requires named initializers for .driver_data. In this case the
> initialization can be dropped as the driver doesn't make use of
> .driver_data at all.
>
> Best regards
> Uwe
>
> drivers/mmc/host/via-sdmmc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c
> index c628b3bbfd7a..8c049f8355cd 100644
> --- a/drivers/mmc/host/via-sdmmc.c
> +++ b/drivers/mmc/host/via-sdmmc.c
> @@ -323,9 +323,8 @@ struct via_crdr_mmc_host {
> #define VIA_CMD_TIMEOUT_MS 1000
>
> static const struct pci_device_id via_ids[] = {
> - {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_9530,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,},
> - {0,}
> + { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_9530) },
> + { }
> };
>
> MODULE_DEVICE_TABLE(pci, via_ids);
>
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> --
> 2.47.3
>