@@ -1357,18 +1357,9 @@ static void __exit unload_cpqphpd(void)
}
static const struct pci_device_id hpcd_pci_tbl[] = {
- {
/* handle any PCI Hotplug controller */
- .class = ((PCI_CLASS_SYSTEM_PCI_HOTPLUG << 8) | 0x00),
- .class_mask = ~0,
-
- /* no matter who makes it */
- .vendor = PCI_ANY_ID,
- .device = PCI_ANY_ID,
- .subvendor = PCI_ANY_ID,
- .subdevice = PCI_ANY_ID,
-
- }, { /* end: all zeroes */ }
+ { PCI_DEVICE_CLASS(((PCI_CLASS_SYSTEM_PCI_HOTPLUG << 8) | 0x00), ~0) },
+ { /* end: all zeroes */ },
};
MODULE_DEVICE_TABLE(pci, hpcd_pci_tbl);
@@ -303,11 +303,7 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
struct pci_dev *from)
{
struct pci_device_id id = {
- .vendor = vendor,
- .device = device,
- .subvendor = ss_vendor,
- .subdevice = ss_device,
- };
+ PCI_DEVICE_SUB(vendor, device, ss_vendor, ss_device) };
return pci_get_dev_by_id(&id, from);
}
@@ -351,13 +347,7 @@ EXPORT_SYMBOL(pci_get_device);
struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
{
struct pci_device_id id = {
- .vendor = PCI_ANY_ID,
- .device = PCI_ANY_ID,
- .subvendor = PCI_ANY_ID,
- .subdevice = PCI_ANY_ID,
- .class_mask = PCI_ANY_ID,
- .class = class,
- };
+ PCI_DEVICE_CLASS(PCI_ANY_ID, class) };
return pci_get_dev_by_id(&id, from);
}
We could make use of PCI_DEVICE_SUB/CLASS() helper macro v1->v2: *fix extra indent for git-apply failure v2->v3: *update the subject line from "function" to "macro" *add changelog to commit message commit date: 7-23-2021 11:00 Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> --- drivers/pci/hotplug/cpqphp_core.c | 13 ++----------- drivers/pci/search.c | 14 ++------------ 2 files changed, 4 insertions(+), 23 deletions(-)