Re: [PATCH] edac: Consistently define pci_device_ids using named initializers

From: Borislav Petkov

Date: Sun May 24 2026 - 17:13:49 EST


On Wed, Apr 29, 2026 at 05:25:13PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> ... and PCI device helpers.
>
> The various struct pci_device_id arrays were initialized mostly by one
> of the PCI_DEVICE macros and then list expressions. The latter isn't
> easily readable if you're not into PCI. Using named initializers is more
> explicit and thus easier to parse.
>
> Also use PCI_DEVICE* helper macros to assign .vendor, .device,
> .subvendor and .subdevice where appropriate and skip explicit
> assignments of 0 (which the compiler takes care of).
>
> The secret plan is to make struct pci_device_id::driver_data an
> anonymous union (similar to
> https://lore.kernel.org/all/cover.1776579304.git.u.kleine-koenig@xxxxxxxxxxxx/)
> and that requires named initializers. But it's also a nice cleanup on
> its own.
>
> This change doesn't introduce changes to the compiled pci_device_id
> arrays. Tested on x86 and arm64.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
> ---
> Hello,
>
> the mentioned follow-up quest allows to do
>
> - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_IE31200_HB_1), .driver_data = (kernel_ulong_t)&snb_cfg },
> + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_IE31200_HB_1), .driver_data_ptr = &snb_cfg },
>
> which gets rid of a bunch of casts and so brings a little bit more type
> safety. This patch is a preparation for that.
>
> I assume a single patch for all of drivers/edac is fine. If not I can
> split per driver.
>
> Best regards
> Uwe
>
> drivers/edac/amd76x_edac.c | 16 ++---
> drivers/edac/e752x_edac.c | 28 ++++----
> drivers/edac/e7xxx_edac.c | 28 ++++----
> drivers/edac/edac_mc.h | 4 +-
> drivers/edac/i3000_edac.c | 10 +--
> drivers/edac/i3200_edac.c | 10 +--
> drivers/edac/i82860_edac.c | 10 +--
> drivers/edac/i82875p_edac.c | 12 ++--
> drivers/edac/i82975x_edac.c | 11 ++-
> drivers/edac/ie31200_edac.c | 86 ++++++++++++------------
> drivers/edac/igen6_edac.c | 130 ++++++++++++++++++------------------
> drivers/edac/x38_edac.c | 10 +--
> 12 files changed, 177 insertions(+), 178 deletions(-)

Applied, thanks.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette