[PATCH] Bluetooth: hci_bcm4377: Use named initializers for pci_device_id array
Uwe Kleine-König (The Capable Hub)
u.kleine-koenig at baylibre.com
Mon May 4 09:09:40 PDT 2026
Initializing a struct using list initializers is hard to read, compared
to that using named initializers is more ideomatic. Convert the macro
used to assign values in the driver's pci_device_id array accordingly.
This change doesn't introduce any changes to the compiled array on an
x86 and an arm64 build.
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig at baylibre.com>
---
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@baylibre.com/).
This requires named initializers for .driver_data. But even without that
this is a nice cleanup making the macro better readable.
Gcc is happy with simplifying the assignment further using
PCI_VDEVICE(BROADCOM, BCM ## id ## _DEVICE_ID), but this is a bit fishy
because PCI_VDEVICE also assigns .class and .class_mask (using list
initializers), so I didn't convert that. Once all pci_device_id use
named initializers, the two zeros can be dropped from PCI_VDEVICE and
this entry simplified accordingly.
Best regards
Uwe
drivers/bluetooth/hci_bcm4377.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/bluetooth/hci_bcm4377.c b/drivers/bluetooth/hci_bcm4377.c
index 925d0a635945..89c317561bfb 100644
--- a/drivers/bluetooth/hci_bcm4377.c
+++ b/drivers/bluetooth/hci_bcm4377.c
@@ -2525,11 +2525,12 @@ static const struct bcm4377_hw bcm4377_hw_variants[] = {
},
};
-#define BCM4377_DEVID_ENTRY(id) \
- { \
- PCI_VENDOR_ID_BROADCOM, BCM##id##_DEVICE_ID, PCI_ANY_ID, \
- PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, \
- BCM##id \
+#define BCM4377_DEVID_ENTRY(id) \
+ { \
+ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BCM ## id ## _DEVICE_ID), \
+ .class = PCI_CLASS_NETWORK_OTHER << 8, \
+ .class_mask = 0xffff00, \
+ .driver_data = BCM ## id, \
}
static const struct pci_device_id bcm4377_devid_table[] = {
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
--
2.47.3
More information about the linux-arm-kernel
mailing list