[PATCH] pwm: Consistently define pci_device_ids using named initializers

Uwe Kleine-König (The Capable Hub)
2026-05-04T08:55:46Z

The .driver_data member in the various struct pci_device_id arrays were
initialized by list expressions. This isn't easily readable if you're
not into PCI. Using named initializers is more explicit and thus easier
to parse.

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@baylibre.com/)
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@baylibre.com>
---
Hello,

the mentioned follow-up quest allows to do

- { PCI_VDEVICE(INTEL, 0x0ac8), .driver_data = (unsigned long)&pwm_lpss_bxt_info },
+ { PCI_VDEVICE(INTEL, 0x0ac8), .driver_data_ptr = &pwm_lpss_bxt_info },

which gets rid of a bunch of casts and so brings a little bit more type
safety. This patch is a preparation for that.

Best regards
Uwe

drivers/pwm/pwm-dwc.c | 2 +-
drivers/pwm/pwm-lpss-pci.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c
index 86b72db58741..49609d132fda 100644
--- a/drivers/pwm/pwm-dwc.c
+++ b/drivers/pwm/pwm-dwc.c
@@ -147,7 +147,7 @@ static int dwc_pwm_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(dwc_pwm_pm_ops, dwc_pwm_suspend, dwc_pwm_resume);

static const struct pci_device_id dwc_pwm_id_table[] = {
- { PCI_VDEVICE(INTEL, 0x4bb7), (kernel_ulong_t)&ehl_pwm_info },
+ { PCI_VDEVICE(INTEL, 0x4bb7), .driver_data = (kernel_ulong_t)&ehl_pwm_info },
{ } /* Terminating Entry */
};
MODULE_DEVICE_TABLE(pci, dwc_pwm_id_table);
diff --git a/drivers/pwm/pwm-lpss-pci.c b/drivers/pwm/pwm-lpss-pci.c
index ae25d9321d75..3a0fd6593520 100644
--- a/drivers/pwm/pwm-lpss-pci.c
+++ b/drivers/pwm/pwm-lpss-pci.c
@@ -48,15 +48,15 @@ static void pwm_lpss_remove_pci(struct pci_dev *pdev)
}

static const struct pci_device_id pwm_lpss_pci_ids[] = {
- { PCI_VDEVICE(INTEL, 0x0ac8), (unsigned long)&pwm_lpss_bxt_info},
- { PCI_VDEVICE(INTEL, 0x0f08), (unsigned long)&pwm_lpss_byt_info},
- { PCI_VDEVICE(INTEL, 0x0f09), (unsigned long)&pwm_lpss_byt_info},
- { PCI_VDEVICE(INTEL, 0x11a5), (unsigned long)&pwm_lpss_tng_info},
- { PCI_VDEVICE(INTEL, 0x1ac8), (unsigned long)&pwm_lpss_bxt_info},
- { PCI_VDEVICE(INTEL, 0x2288), (unsigned long)&pwm_lpss_bsw_info},
- { PCI_VDEVICE(INTEL, 0x2289), (unsigned long)&pwm_lpss_bsw_info},
- { PCI_VDEVICE(INTEL, 0x31c8), (unsigned long)&pwm_lpss_bxt_info},
- { PCI_VDEVICE(INTEL, 0x5ac8), (unsigned long)&pwm_lpss_bxt_info},
+ { PCI_VDEVICE(INTEL, 0x0ac8), .driver_data = (unsigned long)&pwm_lpss_bxt_info },
+ { PCI_VDEVICE(INTEL, 0x0f08), .driver_data = (unsigned long)&pwm_lpss_byt_info },
+ { PCI_VDEVICE(INTEL, 0x0f09), .driver_data = (unsigned long)&pwm_lpss_byt_info },
+ { PCI_VDEVICE(INTEL, 0x11a5), .driver_data = (unsigned long)&pwm_lpss_tng_info },
+ { PCI_VDEVICE(INTEL, 0x1ac8), .driver_data = (unsigned long)&pwm_lpss_bxt_info },
+ { PCI_VDEVICE(INTEL, 0x2288), .driver_data = (unsigned long)&pwm_lpss_bsw_info },
+ { PCI_VDEVICE(INTEL, 0x2289), .driver_data = (unsigned long)&pwm_lpss_bsw_info },
+ { PCI_VDEVICE(INTEL, 0x31c8), .driver_data = (unsigned long)&pwm_lpss_bxt_info },
+ { PCI_VDEVICE(INTEL, 0x5ac8), .driver_data = (unsigned long)&pwm_lpss_bxt_info },
{ },
};
MODULE_DEVICE_TABLE(pci, pwm_lpss_pci_ids);

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
prerequisite-patch-id: a31e1d7b9e6310e9c453afcd2037468686cb552c
prerequisite-patch-id: 7779c63f16ef6f7247cdb71c89e66b27e299eb74
prerequisite-patch-id: 6f920b6f8c31dc0ad1689200c37680755c20ce8b
prerequisite-patch-id: 1fd68e883664147052540eea19769ea9e92d0138
prerequisite-patch-id: fff07090df18a39a361bbb091a3f17223b4606b4
prerequisite-patch-id: d0d54f7acecd560cdeb6ea0c0e5ae77a50695d68
prerequisite-patch-id: 5011234352b266242ce01fd8babbf0459bfb005b
prerequisite-patch-id: a935aab66aa9896437ab9d757ef9fdc859d22495
prerequisite-patch-id: 344256383ec67df7fbbb6e35e4301d3d14b2571f
prerequisite-patch-id: 14c277a51a268cdcb630d888c1bad3334018d11c
prerequisite-patch-id: 93f14fa1ae7c71a1389488e87bf5d4ba8dbddf84
prerequisite-patch-id: efe5e069be2c0c039e895fb10bbbf6510fd773e6
prerequisite-patch-id: 21ac68c87f24f9e1d35f3268c04e5b40f93849c7
prerequisite-patch-id: 84fb61dca584c253aa2e461e97df8aad59159c28
prerequisite-patch-id: 8e7cee5cc55dd50271326313cb258934dd8c3579
prerequisite-patch-id: 38526e2d87a08a78ccdefaf3261751220d645f15
prerequisite-patch-id: e608a54ff3511d5345f0b396fd5d8e9b003b31ec
prerequisite-patch-id: 4a715d89f621a2ffb364abeb15db3fa2b9b83317
prerequisite-patch-id: 6d049443e6399e1266e06ba412601308b0e44cdc
prerequisite-patch-id: a42f44b27a7bf3795c177fd5df47258463114c9d
prerequisite-patch-id: d8b8fe8728706b0abdae18fa7a77fbb50db89aab
prerequisite-patch-id: 2c85231c5c460bdbe3293d275e6e7b9c135a5e7d
prerequisite-patch-id: 60892ec2e01f3559dfb6791d3f13035d46b01ebb
prerequisite-patch-id: ed9523b310540069539cab89374600fd0b23a043
prerequisite-patch-id: 3619058b0eb67d71f94ae209ea44f7e6645594de
prerequisite-patch-id: a867be2bb1f4f5afeaf4effbcbf1a3b3d32655bb
prerequisite-patch-id: 1a8c38d82ef577bedd1a665b130dde53ca32fb65
--
2.47.3