PCI: Add class support in quirk handling
PATCH 1/4 PCI: Add class support in quirk handling
Recently there is new support to make quirk calling will report duration time. That will boot log get more print out with initcall_debug is specified.
Found a lot of quirks are calling for not related devices.
Reason is quirk frame do not support class handling. So quirk code have to use PCI_ANY_ID for vendor/device and let quirk code itself to check class inside the func.
The patch add class and cls_shift into struct pci_fixup. Also update related macro to accept the class and shift.
-v2: fix v1 that left over of sparated patch.
Signed-off-by Yinghai Lu <[email protected]>
--- drivers/pci/quirks.c | 12 ++++++----- include/linux/pci.h | 53 ++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 16 deletions(-)
drivers/pci/quirks.c +7 -5
@@ -2961,17 +2961,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INstatic void pci_do_fixups (struct pci_dev *dev,struct pci_fixup *f,struct pci_fixup *end) { -while (f < end) { -if ((f->vendor == dev->vendor || f->vendor == (u16 )PCI_ANY_ID ) && - (f->device == dev->device || f->device == (u16 )PCI_ANY_ID )) { +for (; f < end; f++) +if ((f->class == (u32) (dev->class >> f->cls_shift) || + f->class == (u32 )PCI_ANY_ID ) && + (f->vendor == dev->vendor || + f->vendor == (u16 )PCI_ANY_ID ) && + (f->device == dev->device || + f->device == (u16 )PCI_ANY_ID )) {dev_dbg (&dev->dev,"calling %pF\n" , f->hook);if (initcall_debug)do_one_fixup_debug (f->hook, dev);else f->hook (dev); } - f++; - } }extern struct pci_fixup __start_pci_fixups_early[];
include/linux/pci.h +42 -11
79 lines not on this page · raw message